-
Notifications
You must be signed in to change notification settings - Fork 38
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
run error #7
Comments
同问,而且“segged_content.txt”是如何获得的 |
可以通过从json文件中抽取 |
需要预先定义一下,大概是代码中漏定义了。 |
attn可以直接删去,这个是分析的时候看attention 权重的发自我的华为手机-------- 原始邮件 --------主题:Re: [lancopku/Graph-to-seq-comment-generation] run error (#7)发件人:shenjian5 收件人:lancopku/Graph-to-seq-comment-generation 抄送:Subscribed
Traceback (most recent call last):
File "train.py", line 299, in
main()
File "train.py", line 291, in main
max_bleu = train(model, vocab, dataloader, scheduler, optim, updates)
File "train.py", line 118, in train
outputs = model(batch, use_cuda)
File "/opt/lang.huo/miniconda3/envs/huopei/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/opt/lang.huo/mybot/question_generation/models/graph2seq.py", line 93, in forward
contexts, state, attns = self.encode(src, src_mask, concept, concept_mask, title_index, adjs)
File "/opt/lang.huo/mybot/question_generation/models/graph2seq.py", line 71, in encode
return contexts, state, attn
UnboundLocalError: local variable 'attn' referenced before assignment
出现上述错误是因为什么呢?
跪求解答
需要预先定义一下,大概是代码中漏定义了。
—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.
[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "#7 (comment)",
"url": "#7 (comment)",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]
|
Traceback (most recent call last):
File "train.py", line 299, in
main()
File "train.py", line 291, in main
max_bleu = train(model, vocab, dataloader, scheduler, optim, updates)
File "train.py", line 118, in train
outputs = model(batch, use_cuda)
File "/opt/lang.huo/miniconda3/envs/huopei/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/opt/lang.huo/mybot/question_generation/models/graph2seq.py", line 93, in forward
contexts, state, attns = self.encode(src, src_mask, concept, concept_mask, title_index, adjs)
File "/opt/lang.huo/mybot/question_generation/models/graph2seq.py", line 71, in encode
return contexts, state, attn
UnboundLocalError: local variable 'attn' referenced before assignment
出现上述错误是因为什么呢?
跪求解答
The text was updated successfully, but these errors were encountered: