关于evaluation阶段的报错
yanjialele opened this issue · 7 comments
作者您好,打扰了,我在服务器上跑您的代码在evaluation阶段出现了如下报错,请问您遇到过么?期待您的回复!
Traceback (most recent call last):
File "train.py", line 353, in
scores = evaluate_metrics(model, dict_dataloader_val, text_field)
File "train.py", line 62, in evaluate_metrics
out, _ = model.beam_search(images, 20, text_field.vocab.stoi[''], 5, out_size=1,
File "/mnt/hdd1/alluser/yanjialuo/image-captioning-DLCT/models/captioning_model.py", line 70, in beam_search
return bs.apply(visual, out_size, return_probs, **kwargs)
File "/mnt/hdd1/alluser/yanjialuo/image-captioning-DLCT/models/beam_search/beam_search.py", line 71, in apply
visual, outputs = self.iter(t, visual, outputs, return_probs, **kwargs)
File "/mnt/hdd1/alluser/yanjialuo/image-captioning-DLCT/models/beam_search/beam_search.py", line 121, in iter
self.model.apply_to_states(self._expand_state(selected_beam, cur_beam_size))
File "/mnt/hdd1/alluser/yanjialuo/image-captioning-DLCT/models/containers.py", line 30, in apply_to_states
self._buffers[name] = fn(self._buffers[name])
File "/mnt/hdd1/alluser/yanjialuo/image-captioning-DLCT/models/beam_search/beam_search.py", line 26, in fn
s = torch.gather(s.view(*([self.b_s, cur_beam_size] + shape[1:])), 1,
RuntimeError: gather_out_cuda(): Expected dtype int64 for index
@yanjialele 我也遇到了同样的错误,请问您是怎么解决的?
@yanjialele 我也遇到了同样的错误,请问您是怎么解决的?
我记得这个错误好像是高版本的pytorch导致的,用pytorch 1.1就不会有了
多谢回复,可惜我这边gpu不支持1.1,难受
…
---原始邮件--- 发件人: @.> 发送时间: 2022年3月21日(周一) 中午12:18 收件人: @.>; 抄送: @.@.>; 主题: Re: [luo3300612/image-captioning-DLCT] 关于evaluation阶段的报错 (Issue #22) @yanjialele 我也遇到了同样的错误,请问您是怎么解决的? 我记得这个错误好像是高版本的pytorch导致的,用pytorch 1.1就不会有了 — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: @.***>
那你把这一行改一下试试看
selected_beam = selected_idx / candidate_logprob.shape[-1]
改成
selected_beam = (selected_idx / candidate_logprob.shape[-1]).long()
多谢回复,可惜我这边gpu不支持1.1,难受
…
---原始邮件--- 发件人: @.> 发送时间: 2022年3月21日(周一) 中午12:18 收件人: _@**._>; 抄送: _@.@._>; 主题: Re: [luo3300612/image-captioning-DLCT] 关于evaluation阶段的报错 (Issue #22) @yanjialele 我也遇到了同样的错误,请问您是怎么解决的? 我记得这个错误好像是高版本的pytorch导致的,用pytorch 1.1就不会有了 — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: _@_.*>那你把这一行改一下试试看
selected_beam = selected_idx / candidate_logprob.shape[-1]
改成selected_beam = (selected_idx / candidate_logprob.shape[-1]).long()
多谢回复,可惜我这边gpu不支持1.1,难受
…
---原始邮件--- 发件人: @.> 发送时间: 2022年3月21日(周一) 中午12:18 收件人: _@**._>; 抄送: _@.@._>; 主题: Re: [luo3300612/image-captioning-DLCT] 关于evaluation阶段的报错 (Issue #22) @yanjialele 我也遇到了同样的错误,请问您是怎么解决的? 我记得这个错误好像是高版本的pytorch导致的,用pytorch 1.1就不会有了 — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: _@_.*>那你把这一行改一下试试看
selected_beam = selected_idx / candidate_logprob.shape[-1]
改成selected_beam = (selected_idx / candidate_logprob.shape[-1]).long()
你好,同样出现了这个问题,请问你是如何解决的?