BUPT-GAMMA / OpenHGNN

This is an open-source toolkit for Heterogeneous Graph Neural Network(OpenHGNN) based on DGL.
Apache License 2.0
828 stars 141 forks source link

Help needed: Wanted behavior of Experiment.specific_trainerflow.get method and task/trainerflow registration #145

Closed Carayolj closed 1 year ago

Carayolj commented 1 year ago

Hi, I am trying to create a new trainer flow, as well as a new task. I am struggling a bit and have a few questions: When I register them with @register_flow(str_flow) and @register_task(str_task), must str_taskand str_flowbe identical?
Because as my flow is not specific to a model, it is not in the specific_trainerflowdictionnary defined in the Experiment class. So the line 92 in experiment.py( trainerflow = self.specific_trainerflow.get(self.config.model, self.config.task) ) returns the key of the task as the trainerflow_key. Is this the wanted behavior?

Thanks!

Zhanghyi commented 1 year ago

In our system, all trainerflows are registered in SUPPORTED_FLOWS. The trainerflow can be either determined by model_name or task_name. If the model can fit in node_classification or link_prediction, which are two major tasks in gnn, it's ok not to create a new flow for this model. Otherwise, we create a new trainerflow for this model and specify the mapping in specific_trainerflow. Since your flow is not specific to a model, I will assume that the flow and the task match each other and you are going to apply existing models to a new scenario. I suggest that you make them identical. Another more flexible option is that you use openhgnn as a package and only import the model you need in your code.

Carayolj commented 1 year ago

I see, thanks for your answer