-
Notifications
You must be signed in to change notification settings - Fork 91
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
[BUG] Code for real-world cvrplib instance inference. #223
Comments
Have you checked out this notebook? https://github.com/ai4co/rl4co/blob/main/examples/datasets/2-test-on-cvrplib.ipynb There was some small problem with squeezing dimensions for evaluating with batch size of 1, so we made some monkey patching (that should be solved in 0.5.1) Also, here is an example of a recent project based on RL4CO in which we evaluate CVRPLIB (with some extra utilities): https://github.com/ai4co/routefinder/blob/main/examples/2.eval-cvrplib.ipynb |
Follow the https://github.com/ai4co/rl4co/blob/main/examples/datasets/2-test-on-cvrplib.ipynb, i set batch_size=2. However, I still have this problem. If the current version can be used for CVRPlib instance inference? |
I use the same code in https://github.com/ai4co/rl4co/blob/main/examples/2d-meta_train.py for training and the same code in https://github.com/ai4co/rl4co/blob/main/examples/datasets/2-test-on-cvrplib.ipynb for cvrplib instance inference. But the following bug still occur. Traceback (most recent call last): |
Thanks for reporting the bug - you may check the most recent improvements! |
Thanks for the update, it looks like the patch will fix the current bug. |
Hello, I can't solve the instances in cvrplib with the trained model.
Traceback (most recent call last):
File "/NCO/RL4CO/examples/test_cvrplib_demo.py", line 91, in
out = policy(td.clone(), decode_type='greedy', return_actions=True)
File "/miniconda3/envs/rl4co/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/miniconda3/envs/rl4co/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/miniconda3/envs/rl4co/lib/python3.9/site-packages/rl4co/models/common/constructive/base.py", line 237, in forward
td = env.step(td)["next"]
File "/miniconda3/envs/rl4co/lib/python3.9/site-packages/rl4co/envs/common/base.py", line 129, in step
td = self._step(td)
File "/miniconda3/envs/rl4co/lib/python3.9/site-packages/rl4co/envs/routing/cvrp/env.py", line 89, in _step
visited = td["visited"].scatter(-1, current_node, 1)
RuntimeError: Index tensor must have the same number of dimensions as self tensor
The text was updated successfully, but these errors were encountered: