aimagelab / meshed-memory-transformer

Meshed-Memory Transformer for Image Captioning. CVPR 2020

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A code question

GX77 opened this issue · comments

commented

Traceback (most recent call last):
File "/mnt/Pycharm_Remote/DLCT_test/train.py", line 335, in
scores = evaluate_metrics(model, dict_dataloader_val, text_field)
File "/mnt/Pycharm_Remote/DLCT_test/train.py", line 61, in evaluate_metrics
**{'boxes': boxes, 'grids': grids, 'masks': masks})
File "/mnt/Pycharm_Remote/DLCT_test/models/captioning_model.py", line 70, in beam_search
return bs.apply(visual, out_size, return_probs, **kwargs)
File "/mnt/Pycharm_Remote/DLCT_test/models/beam_search/beam_search.py", line 71, in apply
visual, outputs = self.iter(t, visual, outputs, return_probs, **kwargs)
File "/mnt/Pycharm_Remote/DLCT_test/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/Pycharm_Remote/DLCT_test/models/containers.py", line 30, in apply_to_states
self._buffers[name] = fn(self._buffers[name])
File "/mnt/Pycharm_Remote/DLCT_test/models/beam_search/beam_search.py", line 27, in fn
beam.expand(*([self.b_s, self.beam_size] + shape[1:])))
RuntimeError: gather_out_cuda(): Expected dtype int64 for index

the beam is float and come from "selected_beam = selected_idx / candidate_logprob.shape[-1]",so it's float.But index need int. Can you help me?

I found this issue before. Please refer kdexd/virtex#20
Specifically, in beam_search.py , line 118. '/ ' ->' // '

@TBI805 how u create the conda env? I failed on my win10, is the problem of my default conda source?

@TBI805 how u create the conda env? I failed on my win10, is the problem of my default conda source?

Sorry, I have not run the code on win 10.
On Ubuntu 20.04, I can create the conda env directly. But there were some version errors of pip.

I found this issue before. Please refer kdexd/virtex#20
Specifically, in beam_search.py , line 118. '/ ' ->' // '

I modified the code according to the above, but a new problem appeared, Would you please give me some tips?

Traceback (most recent call last):
File "test.py", line 77, in
scores = predict_captions(model, dict_dataloader_test, text_field)
File "test.py", line 36, in predict_captions
scores, _ = evaluation.compute_scores(gts, gen)
File "/home/bwh/python/meshed-memory-transformer-master/evaluation/init.py", line 13, in compute_scores
score, scores = metric.compute_score(gts, gen)
File "/home/bwh/python/meshed-memory-transformer-master/evaluation/meteor/meteor.py", line 46, in compute_score
stat = self._stat(res[i][0], gts[i])
File "/home/bwh/python/meshed-memory-transformer-master/evaluation/meteor/meteor.py", line 63, in _stat
self.meteor_p.stdin.flush()
BrokenPipeError: [Errno 32] Broken pipe

@Baixiaobai201619707 Please refer https://github.com/luo3300612/image-captioning-DLCT. Firstly, download the evaluation tools, and then replace the whole evaluation folder of m2 with DLCT.

@TBI805 Thank you. I can train the model normally, but can you tell me why?

@Baixiaobai201619707 Sorry, I don't know the reason. Maybe it caused by the version of pytorch or conda env,I guess.

@TBI805 Ok,thank you.

@Baixiaobai201619707 Please refer https://github.com/luo3300612/image-captioning-DLCT. Firstly, download the evaluation tools, and then replace the whole evaluation folder of m2 with DLCT.
If I replace the evaluation folder with eval.py in DLCT , do I need to edit the code in train.py? Or I just need to delete the evaluation folder,paste the eval.py in DLCT and run the train.py directly?

@Baixiaobai201619707 Please refer https://github.com/luo3300612/image-captioning-DLCT. Firstly, download the evaluation tools, and then replace the whole evaluation folder of m2 with DLCT.
If I replace the evaluation folder with eval.py in DLCT , do I need to edit the code in train.py? Or I just need to delete the evaluation folder,paste the eval.py in DLCT and run the train.py directly?

You just need to delete the original evaluation folder of m2, and then paste the DLCT’s evaluation folder.

@Baixiaobai201619707 Please refer https://github.com/luo3300612/image-captioning-DLCT. Firstly, download the evaluation tools, and then replace the whole evaluation folder of m2 with DLCT.
If I replace the evaluation folder with eval.py in DLCT , do I need to edit the code in train.py? Or I just need to delete the evaluation folder,paste the eval.py in DLCT and run the train.py directly?

You just need to delete the original evaluation folder of m2, and then paste the DLCT’s evaluation folder.

Thanks a lot ^_^

I replaced the evaluation folder,but it occurred this error. Do you know why?

@Baixiaobai201619707 Please refer https://github.com/luo3300612/image-captioning-DLCT. Firstly, download the evaluation tools, and then replace the whole evaluation folder of m2 with DLCT.
If I replace the evaluation folder with eval.py in DLCT , do I need to edit the code in train.py? Or I just need to delete the evaluation folder,paste the eval.py in DLCT and run the train.py directly?

You just need to delete the original evaluation folder of m2, and then paste the DLCT’s evaluation folder.
Have you ever met the Error 22 Invalid argument when you run the test.py?
image

I replaced the evaluation folder,but it occurred this error. Do you know why?

@Baixiaobai201619707 Please refer https://github.com/luo3300612/image-captioning-DLCT. Firstly, download the evaluation tools, and then replace the whole evaluation folder of m2 with DLCT.
If I replace the evaluation folder with eval.py in DLCT , do I need to edit the code in train.py? Or I just need to delete the evaluation folder,paste the eval.py in DLCT and run the train.py directly?

You just need to delete the original evaluation folder of m2, and then paste the DLCT’s evaluation folder.
Have you ever met the Error 22 Invalid argument when you run the test.py?
image

@z972778371 all of the path names should not include spacebar, you can replace the spacebar with “_”

@TBI805 Hello, excuse me. I want to ask you a question,when you train the dlct model, do you encounter the problem that the cache keeps increasing? My cache keeps increasing when I run it and eventually the model gets stuck.

@TBI805 Hello, excuse me. I want to ask you a question,when you train the dlct model, do you encounter the problem that the cache keeps increasing? My cache keeps increasing when I run it and eventually the model gets stuck.

Yeah, but I have not solved this problem. I increase the virtual memory to avoid it.

@TBI805 Hello, excuse me. I want to ask you a question,when you train the dlct model, do you encounter the problem that the cache keeps increasing? My cache keeps increasing when I run it and eventually the model gets stuck.

Yeah, but I have not solved this problem. I increase the virtual memory to avoid it.

I can't run the model right now. Could you please teach me how to use it?My email account is bwh0215@163.com, thanks a lot.

@TBI805 Hello, excuse me. I want to ask you a question,when you train the dlct model, do you encounter the problem that the cache keeps increasing? My cache keeps increasing when I run it and eventually the model gets stuck.

Yeah, but I have not solved this problem. I increase the virtual memory to avoid it.

I want to reproduce the visualization results, but I cannot find the corresponding code in this repo.Can you please tell me how to achieve it?