aimagelab / meshed-memory-transformer

Meshed-Memory Transformer for Image Captioning. CVPR 2020
BSD 3-Clause "New" or "Revised" License
517 stars 136 forks source link

A code question #60

Open GX77 opened 3 years ago

GX77 commented 3 years ago

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?

TBI805 commented 3 years ago

I found this issue before. Please refer https://github.com/kdexd/virtex/issues/20 Specifically, in beam_search.py , line 118. '/ ' ->' // '

z972778371 commented 3 years ago

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

TBI805 commented 3 years ago

@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.

Baixiaobai201619707 commented 3 years ago

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 predictcaptions 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

TBI805 commented 3 years ago

@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.

Baixiaobai201619707 commented 3 years ago

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

TBI805 commented 3 years ago

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

Baixiaobai201619707 commented 3 years ago

@TBI805 Ok,thank you.

z972778371 commented 2 years ago

@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?

TBI805 commented 2 years ago

@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.

z972778371 commented 2 years ago

@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 ^_^

z972778371 commented 2 years ago

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

TBI805 commented 2 years ago

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 “_”

Baixiaobai201619707 commented 2 years ago

@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 commented 2 years ago

@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.

Baixiaobai201619707 commented 2 years ago

@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.

buproof commented 1 year ago

@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?