Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexErrors in cvrp evaluation #1

Open
danielathyssens opened this issue Jul 20, 2021 · 1 comment
Open

IndexErrors in cvrp evaluation #1

danielathyssens opened this issue Jul 20, 2021 · 1 comment

Comments

@danielathyssens
Copy link

danielathyssens commented Jul 20, 2021

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!

@danielathyssens danielathyssens changed the title RuntimeErrors for cvrp evaluation IndexErrors in cvrp evaluation Jul 20, 2021
@liangxinedu
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants