How can mmengine based projects use the Hook mechanism to monitor and analyze certain states during the training process? #832
Replies: 3 comments 1 reply
-
We recommend using English or English & Chinese for issues so that we could have broader discussion. |
Beta Was this translation helpful? Give feedback.
-
I want to use the def after_train_iter(self, runner, batch_idx, data_batch=None, outputs=None):interface of hook to analyze some intermediate results (model training results) obtained during training in an mmengine based project, but there is no context variable in this interface to store this state (intermediate state generated during training). If I want to implement this feature, is it possible to do it through a hook mechanism or is there any other mechanism to do it? It seems that iter and epoch are not easy to get in the model structure if it is done by hard coding, is anyone clear? It seems that only |
Beta Was this translation helpful? Give feedback.
-
MessageHub is a class that allows different components to exchange information. Here is an example: def method_in_model(...)
message_hub = MessageHub.get_current_instance()
message_hub.update_info(...) # Update the information that needs to be exchanged to the message_hub
def method_in_hook(...):
message_hub = MessageHub.get_current_instance()
message_hub.get_info(...) # Get the updated information from the model You can get more information about how to share messages between different components with |
Beta Was this translation helpful? Give feedback.
-
What is the feature?
我想在在基于mmengine的项目中时候用hook的def after_train_iter(self, runner, batch_idx, data_batch=None, outputs=None):接口中实现对训练时候得到的某些中间结果(模型训练产生的结果)进行分析,但是这个接口中没有一个context上下文的变量来存储这个状态(训练时产生的中间状态),请问如果想实现这个功能,通过hook机制可以实现吗或者有其他机制可以实现?如果采用硬编码完成,在模型结构里面似乎不好获得iter 和 epoch ,有人清楚么
batch_idx
data_batch
outputs
这三个变量都似乎只有outputs可以用来保存训练时候的上下文信息,是这样吗
Any other context?
No response
Beta Was this translation helpful? Give feedback.
All reactions