gather_out_cuda(): Expected dtype int64 for index
在 Dual-Level Collaborative Transformer for Image Captioning复现代码的时候发现bug。
问题原因:由于pytorch版本不对
因为我的显卡是gtx3090,所以cuda版本只能是11.0,安装的pytorch1.7
解决思路:
初始代码:
selected_beam = selected_idx / candidate_logprob.shape[-1]
更改后的代码:
selected_beam = selected_idx // candidate_logprob.shape[-1]
更改路径:image-captioning-DLCT-main/models/beam_search/beam_search.py,的第118行
附件:开源代码路径
感谢:https://giters.com/kdexd/virtex/issues/20提供修改思路!!!