-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom GraphGym config not working #5211
Comments
Thanks for reporting. I think this is fully intentional and the |
Sorry, maybe my minimal working example was a bit too minimal.
and when I try to access it for example in a custom encoder: import torch
from torch_geometric.graphgym.config import cfg
from torch_geometric.graphgym.register import register_node_encoder
@register_node_encoder('example')
class ExampleNodeEncoder(torch.nn.Module):
def __init__(self, emb_dim, num_classes=None):
super().__init__()
# Some dummy code to throw the error
self.example = cfg.example_arg
self.encoder = torch.nn.Embedding(num_classes, emb_dim)
torch.nn.init.xavier_uniform_(self.encoder.weight.data)
def forward(self, batch):
# Encode just the first dimension if more exist
batch.x = self.encoder(batch.x[:, 0])
return batch I get a similar error as above. I thought this is what the custom configs are for or did I misunderstand something? |
I think you need to register the new attribute in @register_node_encoder('example')
class ExampleNodeEncoder(torch.nn.Module):
pass
cfg.example_arg = default_value |
That works, thank you. But then what is a use case for By the way: While testing this I found another bug and tried to fix it here: #5243 |
Oh, you are right. You can also register a new config and initialize |
I just ran into the same issue. I am trying to create custom config args to specify in the yaml file, so that I can also use these custom configs in my other custom graphgym modules. It does seem like these custom configs are supposed to be set in lines 448-450 in
However, it doesn't seem to be working as intended because the first time I was able to fix this issue by running |
@JiaxuanYou Can you take a look? |
A bit more on this: turns out running
This will not work, because |
I solved the issue by creating all my custom configs in the module's |
Any updates on this? For me what worked (partially) was to run |
The current solution I have is to call the registered configuration in the main.py manually. It only needs to be done once, considering the custom configuration.
in main.py
|
🐛 Describe the bug
Registering custom configs in GraphGym does not work. It is already not possible to access the custom configs that are specified in the example. To reproduce:
graphgym\main.py
by adding the following after line 31:run_single.sh
If I do this I get the following error:
Environment
conda
,pip
, source): viapip install git+https://github.com/pyg-team/pytorch_geometric
The text was updated successfully, but these errors were encountered: