meshed-memory-transformer icon indicating copy to clipboard operation
meshed-memory-transformer copied to clipboard

A code question

Open GX77 opened this issue 2 years ago • 17 comments

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?

GX77 avatar Aug 25 '21 08:08 GX77

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

TBI805 avatar Aug 27 '21 03:08 TBI805

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

z972778371 avatar Sep 01 '21 01:09 z972778371

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

TBI805 avatar Sep 02 '21 12:09 TBI805

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 avatar Sep 15 '21 14:09 Baixiaobai201619707

@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 avatar Sep 15 '21 22:09 TBI805

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

Baixiaobai201619707 avatar Sep 16 '21 02:09 Baixiaobai201619707

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

TBI805 avatar Sep 16 '21 13:09 TBI805

@TBI805 Ok,thank you.

Baixiaobai201619707 avatar Sep 17 '21 02:09 Baixiaobai201619707

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

z972778371 avatar Oct 24 '21 10:10 z972778371

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

TBI805 avatar Oct 24 '21 11:10 TBI805

@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 avatar Oct 24 '21 14:10 z972778371

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 avatar Oct 26 '21 00:10 z972778371

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 avatar Nov 20 '21 04:11 TBI805

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

Baixiaobai201619707 avatar Apr 05 '22 15:04 Baixiaobai201619707

@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 avatar Apr 06 '22 03:04 TBI805

@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 [email protected], thanks a lot.

Baixiaobai201619707 avatar Apr 06 '22 04:04 Baixiaobai201619707

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

buproof avatar Nov 11 '22 03:11 buproof