We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I met the problem on Linux with pygod 1.1.0 version, here's my code: from torch_geometric.data import Data from pygod.detector import GADNR feature = torch.randn(1000, 64) edge_index = torch.randint(0, 1000, (2, 5000)) labels = torch.randint(0, 5, (1000,)) data = Data(x=feature, edge_index=edge_index, y=labels) print(data) model = GADNR(gpu=0, hid_dim=16, num_layers=2, epoch=200) model.fit(data) and the output is: Data(x=[1000, 64], edge_index=[2, 5000], y=[1000]) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[9], line 11 9 print(data) 10 model = GADNR(gpu=0, hid_dim=16, num_layers=2, epoch=200) ---> 11 model.fit(data) File [~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/pygod/detector/gadnr.py:311](http://localhost:8888/doc/tree/~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/pygod/detector/gadnr.py#line=310), in GADNR.fit(self, data, label, h_loss_weight, degree_loss_weight, feature_loss_weight, loss_step) 307 loader = NeighborLoader(data, 308 self.num_neigh, 309 batch_size=self.batch_size) 310 self.full_batch = False --> 311 self.model = self.init_model(**self.kwargs) 312 if self.compile_model: 313 self.model = compile(self.model) File [~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/pygod/detector/gadnr.py:204](http://localhost:8888/doc/tree/~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/pygod/detector/gadnr.py#line=203), in GADNR.init_model(self, **kwargs) 201 if self.save_emb: 202 self.emb = torch.zeros(self.num_nodes, self.hid_dim) --> 204 return GADNRBase(in_dim=self.in_dim, hid_dim=self.hid_dim, 205 encoder_layers=self.encoder_layers, 206 deg_dec_layers=self.deg_dec_layers, 207 fea_dec_layers=self.fea_dec_layers, 208 sample_size=self.sample_size, 209 sample_time=self.sample_time, 210 neighbor_num_list=self.neighbor_num_list, 211 tot_nodes=self.tot_nodes, 212 neigh_loss=self.neigh_loss, 213 lambda_loss1=self.lambda_loss1, 214 lambda_loss2=self.lambda_loss2, 215 lambda_loss3=self.lambda_loss3, 216 full_batch=self.full_batch, 217 backbone=self.backbone, 218 device=self.device).to(self.device) File [~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/pygod/nn/gadnr.py:136](http://localhost:8888/doc/tree/~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/pygod/nn/gadnr.py#line=135), in GADNRBase.__init__(self, in_dim, hid_dim, encoder_layers, deg_dec_layers, fea_dec_layers, sample_size, sample_time, neighbor_num_list, neigh_loss, lambda_loss1, lambda_loss2, lambda_loss3, full_batch, dropout, act, backbone, device, **kwargs) 133 self.mlp_gen = MLP_generator(hid_dim, hid_dim) 135 # Encoder --> 136 self.shared_encoder = backbone(in_channels=hid_dim, 137 hidden_channels=hid_dim, 138 num_layers=encoder_layers, 139 out_channels=hid_dim, 140 dropout=dropout, 141 act=act, 142 **kwargs) 144 # Decoder 145 self.degree_decoder = FNN_GAD_NR(hid_dim, hid_dim, 1, deg_dec_layers) File [~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/torch_geometric/nn/models/basic_gnn.py:106](http://localhost:8888/doc/tree/~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/torch_geometric/nn/models/basic_gnn.py#line=105), in BasicGNN.__init__(self, in_channels, hidden_channels, num_layers, out_channels, dropout, act, act_first, act_kwargs, norm, norm_kwargs, jk, **kwargs) 103 self.convs = ModuleList() 104 if num_layers > 1: 105 self.convs.append( --> 106 self.init_conv(in_channels, hidden_channels, **kwargs)) 107 if isinstance(in_channels, (tuple, list)): 108 in_channels = (hidden_channels, hidden_channels) File [~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/torch_geometric/nn/models/basic_gnn.py:430](http://localhost:8888/doc/tree/~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/torch_geometric/nn/models/basic_gnn.py#line=429), in GCN.init_conv(self, in_channels, out_channels, **kwargs) 428 def init_conv(self, in_channels: int, out_channels: int, 429 **kwargs) -> MessagePassing: --> 430 return GCNConv(in_channels, out_channels, **kwargs) File [~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/torch_geometric/nn/conv/gcn_conv.py:190](http://localhost:8888/doc/tree/~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/torch_geometric/nn/conv/gcn_conv.py#line=189), in GCNConv.__init__(self, in_channels, out_channels, improved, cached, add_self_loops, normalize, bias, **kwargs) 178 def __init__( 179 self, 180 in_channels: int, (...) 187 **kwargs, 188 ): 189 kwargs.setdefault('aggr', 'add') --> 190 super().__init__(**kwargs) 192 if add_self_loops is None: 193 add_self_loops = normalize TypeError: MessagePassing.__init__() got an unexpected keyword argument 'tot_nodes' How can i fix it?
I met the problem on Linux with pygod 1.1.0 version, here's my code:
from torch_geometric.data import Data from pygod.detector import GADNR feature = torch.randn(1000, 64) edge_index = torch.randint(0, 1000, (2, 5000)) labels = torch.randint(0, 5, (1000,)) data = Data(x=feature, edge_index=edge_index, y=labels) print(data) model = GADNR(gpu=0, hid_dim=16, num_layers=2, epoch=200) model.fit(data)
and the output is:
Data(x=[1000, 64], edge_index=[2, 5000], y=[1000]) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[9], line 11 9 print(data) 10 model = GADNR(gpu=0, hid_dim=16, num_layers=2, epoch=200) ---> 11 model.fit(data) File [~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/pygod/detector/gadnr.py:311](http://localhost:8888/doc/tree/~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/pygod/detector/gadnr.py#line=310), in GADNR.fit(self, data, label, h_loss_weight, degree_loss_weight, feature_loss_weight, loss_step) 307 loader = NeighborLoader(data, 308 self.num_neigh, 309 batch_size=self.batch_size) 310 self.full_batch = False --> 311 self.model = self.init_model(**self.kwargs) 312 if self.compile_model: 313 self.model = compile(self.model) File [~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/pygod/detector/gadnr.py:204](http://localhost:8888/doc/tree/~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/pygod/detector/gadnr.py#line=203), in GADNR.init_model(self, **kwargs) 201 if self.save_emb: 202 self.emb = torch.zeros(self.num_nodes, self.hid_dim) --> 204 return GADNRBase(in_dim=self.in_dim, hid_dim=self.hid_dim, 205 encoder_layers=self.encoder_layers, 206 deg_dec_layers=self.deg_dec_layers, 207 fea_dec_layers=self.fea_dec_layers, 208 sample_size=self.sample_size, 209 sample_time=self.sample_time, 210 neighbor_num_list=self.neighbor_num_list, 211 tot_nodes=self.tot_nodes, 212 neigh_loss=self.neigh_loss, 213 lambda_loss1=self.lambda_loss1, 214 lambda_loss2=self.lambda_loss2, 215 lambda_loss3=self.lambda_loss3, 216 full_batch=self.full_batch, 217 backbone=self.backbone, 218 device=self.device).to(self.device) File [~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/pygod/nn/gadnr.py:136](http://localhost:8888/doc/tree/~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/pygod/nn/gadnr.py#line=135), in GADNRBase.__init__(self, in_dim, hid_dim, encoder_layers, deg_dec_layers, fea_dec_layers, sample_size, sample_time, neighbor_num_list, neigh_loss, lambda_loss1, lambda_loss2, lambda_loss3, full_batch, dropout, act, backbone, device, **kwargs) 133 self.mlp_gen = MLP_generator(hid_dim, hid_dim) 135 # Encoder --> 136 self.shared_encoder = backbone(in_channels=hid_dim, 137 hidden_channels=hid_dim, 138 num_layers=encoder_layers, 139 out_channels=hid_dim, 140 dropout=dropout, 141 act=act, 142 **kwargs) 144 # Decoder 145 self.degree_decoder = FNN_GAD_NR(hid_dim, hid_dim, 1, deg_dec_layers) File [~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/torch_geometric/nn/models/basic_gnn.py:106](http://localhost:8888/doc/tree/~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/torch_geometric/nn/models/basic_gnn.py#line=105), in BasicGNN.__init__(self, in_channels, hidden_channels, num_layers, out_channels, dropout, act, act_first, act_kwargs, norm, norm_kwargs, jk, **kwargs) 103 self.convs = ModuleList() 104 if num_layers > 1: 105 self.convs.append( --> 106 self.init_conv(in_channels, hidden_channels, **kwargs)) 107 if isinstance(in_channels, (tuple, list)): 108 in_channels = (hidden_channels, hidden_channels) File [~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/torch_geometric/nn/models/basic_gnn.py:430](http://localhost:8888/doc/tree/~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/torch_geometric/nn/models/basic_gnn.py#line=429), in GCN.init_conv(self, in_channels, out_channels, **kwargs) 428 def init_conv(self, in_channels: int, out_channels: int, 429 **kwargs) -> MessagePassing: --> 430 return GCNConv(in_channels, out_channels, **kwargs) File [~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/torch_geometric/nn/conv/gcn_conv.py:190](http://localhost:8888/doc/tree/~/anaconda3/envs/llm4gad/lib/python3.12/site-packages/torch_geometric/nn/conv/gcn_conv.py#line=189), in GCNConv.__init__(self, in_channels, out_channels, improved, cached, add_self_loops, normalize, bias, **kwargs) 178 def __init__( 179 self, 180 in_channels: int, (...) 187 **kwargs, 188 ): 189 kwargs.setdefault('aggr', 'add') --> 190 super().__init__(**kwargs) 192 if add_self_loops is None: 193 add_self_loops = normalize TypeError: MessagePassing.__init__() got an unexpected keyword argument 'tot_nodes'
How can i fix it?
Originally posted by @Taotiee in #111
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Originally posted by @Taotiee in #111
The text was updated successfully, but these errors were encountered: