aimagelab / meshed-memory-transformer

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

Error on testing the network on Windows 10 #45

Open marcomameli1992 opened 3 years ago

marcomameli1992 commented 3 years ago

I'm traying to test the network on my windows 10 notebook. I configure all the packages but when the test start it gives me the next error:

Traceback (most recent call last): File "", line 1, in File "C:\Program Files\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev_pydev_bundle\pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "C:\Program Files\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "E:/DeepLearning/Fashion/FeaturesExtraction/FashionFeaturesExtraction/captioning/meshed-memory-transformer/test.py", line 77, in scores = predict_captions(model, dict_dataloader_test, text_field) File "E:/DeepLearning/Fashion/FeaturesExtraction/FashionFeaturesExtraction/captioning/meshed-memory-transformer/test.py", line 26, in predictcaptions out, = model.beam_search(images, 20, text_field.vocab.stoi[''], 5, out_size=1) File "E:\DeepLearning\Fashion\FeaturesExtraction\FashionFeaturesExtraction\captioning\meshed-memory-transformer\models\captioning_model.py", line 70, in beam_search return bs.apply(visual, out_size, return_probs, kwargs) File "E:\DeepLearning\Fashion\FeaturesExtraction\FashionFeaturesExtraction\captioning\meshed-memory-transformer\models\beam_search\beam_search.py", line 71, in apply visual, outputs = self.iter(t, visual, outputs, return_probs, kwargs) File "E:\DeepLearning\Fashion\FeaturesExtraction\FashionFeaturesExtraction\captioning\meshed-memory-transformer\models\beam_search\beam_search.py", line 121, in iter self.model.apply_to_states(self._expand_state(selected_beam, cur_beam_size)) File "E:\DeepLearning\Fashion\FeaturesExtraction\FashionFeaturesExtraction\captioning\meshed-memory-transformer\models\containers.py", line 30, in apply_to_states self._buffers[name] = fn(self._buffers[name]) File "E:\DeepLearning\Fashion\FeaturesExtraction\FashionFeaturesExtraction\captioning\meshed-memory-transformer\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

TanayDeshmukh commented 3 years ago

@marcomameli1992 I'm facing the same issue as well. Were you able to resolve it?

Corleone-Huang commented 3 years ago

I have the same problem too. Does anyone know how to solve this problem? help!

Corleone-Huang commented 3 years ago

ok, I find a way to solve the problem in another issue!

osolo98 commented 3 years ago

@CoreloneH care to share how you solved your problem???

Corleone-Huang commented 3 years ago

hi,@osolo98 you can find the solution in issue #39. The solution is that You can modify a line of code(line 118):selected_beam = selected_idx / /candidate_logprob.shape[-1] meshed-memory-transformer/models/beam_search/beam_search.py which can address this problem.

osolo98 commented 3 years ago

thank you @CoreloneH . got it.