DHGPNTM / STT

7 stars 1 forks source link

AttributeError: 'GCNConv' object has no attribute 'weight' #5

Open Ywinh opened 2 weeks ago

Ywinh commented 2 weeks ago

您好,在运行代码时遇到这个问题

Namespace(epoch=50, batch_size=16, d_model=64, n_warmup_steps=1000, dropout=0.3, embs_share_weight=False, proj_share_weight=False, log=None, save_path='./checkpoint/DiffusionPrediction.pt', save_mode='best', no_cuda=False, network=False, pos_emb=True, warmup=10, notes='', d_word_vec=64)
  File "c:\Users\Yin\Desktop\STT-main\run.py", line 220, in <module>
    train_model(model, data_path)
  File "c:\Users\Yin\Desktop\STT-main\run.py", line 155, in train_model
    model = DyHGCN(opt)
            ^^^^^^^^^^^
  File "c:\Users\Yin\Desktop\STT-main\DyHGCN.py", line 188, in __init__
    self.gnn_layer = GraphNN(ntoken, ninp)
                     ^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Yin\Desktop\STT-main\DyHGCN.py", line 34, in __init__
    self.init_weights()
  File "c:\Users\Yin\Desktop\STT-main\DyHGCN.py", line 38, in init_weights
    init.xavier_normal_(self.gnn1.weight)
                        ^^^^^^^^^^^^^^^^
  File "C:\Users\Yin\anaconda3\Lib\site-packages\torch\nn\modules\module.py", line 1709, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'GCNConv' object has no attribute 'weight'

请问应该如何解决,如果简单注释掉会影响代码结果吗

DHGPNTM commented 2 weeks ago

直接注掉就可以

〒_〒555~…… @.***

 

------------------ 原始邮件 ------------------ 发件人: "DHGPNTM/STT" @.>; 发送时间: 2024年6月17日(星期一) 凌晨0:23 @.>; @.***>; 主题: [DHGPNTM/STT] AttributeError: 'GCNConv' object has no attribute 'weight' (Issue #5)

您好,在运行代码时遇到这个问题 Namespace(epoch=50, batch_size=16, d_model=64, n_warmup_steps=1000, dropout=0.3, embs_share_weight=False, proj_share_weight=False, log=None, save_path='./checkpoint/DiffusionPrediction.pt', save_mode='best', no_cuda=False, network=False, pos_emb=True, warmup=10, notes='', d_word_vec=64) File "c:\Users\Yin\Desktop\STT-main\run.py", line 220, in <module> train_model(model, data_path) File "c:\Users\Yin\Desktop\STT-main\run.py", line 155, in train_model model = DyHGCN(opt) ^^^^^^^^^^^ File "c:\Users\Yin\Desktop\STT-main\DyHGCN.py", line 188, in init self.gnn_layer = GraphNN(ntoken, ninp) ^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\Yin\Desktop\STT-main\DyHGCN.py", line 34, in init self.init_weights() File "c:\Users\Yin\Desktop\STT-main\DyHGCN.py", line 38, in init_weights init.xaviernormal(self.gnn1.weight) ^^^^^^^^^^^^^^^^ File "C:\Users\Yin\anaconda3\Lib\site-packages\torch\nn\modules\module.py", line 1709, in getattr raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'") AttributeError: 'GCNConv' object has no attribute 'weight'
请问应该如何解决,如果简单注释掉会影响代码结果吗

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>