liangxinedu / MDAM

MIT License
46 stars 10 forks source link

IndexErrors in cvrp evaluation #1

Open danielathyssens opened 3 years ago

danielathyssens commented 3 years ago

In running the given command in the ReadMe for evaluating the cvrp:

CUDA_VISIBLE_DEVICES="0" python -u search.py data/vrp_20.pkl --model pretrained/vrp_20/epoch-99.pt --beam_size 30 --eval_batch_size 1024

I get an IndexError.

Using python 3.7 and torch 1.9.0+cu102, I get a "IndexError: tensors used as indices must be long, byte or bool tensors" following the "mask_beam = mask_beam[torch.arange(batch_size).view(-1, 1), top_index / expand_size]" expression in model_search.py (line 324).

The problem seems to be that "top_index /expand_size" yields a tensor of floats e.g. [[0.0000, 0.3333, 0.6667],...], which cannot be used as indices for mask_beam.

Also, could you please add the dependencies and requirements for executing the code successfully?

Many thanks in advance!

liangxinedu commented 3 years ago

Thank you for asking. We were using an older version of torch. We have just updated the code for the latest version (1.9.0) and added the dependencies.

Sorry for the inconvenience.