luo3300612 / image-captioning-DLCT

Official pytorch implementation of paper "Dual-Level Collaborative Transformer for Image Captioning" (AAAI 2021).
BSD 3-Clause "New" or "Revised" License
193 stars 31 forks source link

关于evaluation阶段的报错 #22

Closed yanjialele closed 2 years ago

yanjialele commented 2 years ago

作者您好,打扰了,我在服务器上跑您的代码在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 evaluatemetrics 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

tianjunyu0871 commented 2 years ago

@yanjialele 我也遇到了同样的错误,请问您是怎么解决的?

luo3300612 commented 2 years ago

@yanjialele 我也遇到了同样的错误,请问您是怎么解决的?

我记得这个错误好像是高版本的pytorch导致的,用pytorch 1.1就不会有了

tianjunyu0871 commented 2 years ago

多谢回复,可惜我这边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: @.***>

luo3300612 commented 2 years ago

多谢回复,可惜我这边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()

tianjunyu0871 commented 2 years ago

多谢指导,可以运行了

---原始邮件--- 发件人: @.> 发送时间: 2022年3月21日(周一) 晚上9:22 收件人: @.>; 抄送: @.**@.>; 主题: Re: [luo3300612/image-captioning-DLCT] 关于evaluation阶段的报错 (Issue #22)

多谢回复,可惜我这边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()

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

tianjunyu0871 commented 2 years ago

多谢回复,可惜我这边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()

image 您好,我是用readme里的参数进行训练和测试,出现了如图的问题,请问这是什么情况呢,该如何解决。

egoistsh commented 1 year ago

多谢回复,可惜我这边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()

image 您好,我是用readme里的参数进行训练和测试,出现了如图的问题,请问这是什么情况呢,该如何解决。

你好,同样出现了这个问题,请问你是如何解决的?