alexfrom0815 / Online-3D-BPP-DRL

This repository contains the implementation of paper Online 3D Bin Packing with Constrained Deep Reinforcement Learning.
292 stars 66 forks source link

Unable to access or Execute the env files bin3D.py #2

Closed kashifzr closed 3 years ago

kashifzr commented 3 years ago

After registering my envs i am trying to see why I am unable to run the code Below is the screen shots when I try to figure about the environment and the command to execute the algorithm works

python3
Python 3.6.9 (default, Jan 26 2021, 15:33:00) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gym
>>> import envs
>>> gym.make("Bpp-v0")
[2021-05-10 12:07:01,457] Making new env: Bpp-v0
/home/abc/.local/lib/python3.6/site-packages/gym/envs/registration.py:17: PkgResourcesDeprecationWarning: Parameters to load are deprecated.  Call .resolve and .require separately.
  result = entry_point.load(False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/abc/.local/lib/python3.6/site-packages/gym/envs/registration.py", line 161, in make
    return registry.make(id)
  File "/home/abc/.local/lib/python3.6/site-packages/gym/envs/registration.py", line 119, in make
    env = spec.make()
  File "/home/abc/.local/lib/python3.6/site-packages/gym/envs/registration.py", line 86, in make
    env = cls(**self._kwargs)
  File "/home/abc/Online-3D-BPP-DRL/envs/bpp0/bin3D.py", line 20, in __init__
    assert box_set is not None
AssertionError
python3 main.py --mode train --load-model --use-cuda --item-seq sample
continue training model "default_cut_2.pt"
the dataset used:  cut_2.pt
the range of item size:   (2, 2, 2, 5, 5, 5)
the size of bin:   (10, 10, 10)
the number of known items:   1
item sequence generator:   sample
enable_rotation:  False
use cuda:   True
item set:  [(2, 2, 2), (2, 2, 3), (2, 2, 4), (2, 2, 5), (2, 3, 2), (2, 3, 3), (2, 3, 4), (2, 3, 5), (2, 4, 2), (2, 4, 3), (2, 4, 4), (2, 4, 5), (2, 5, 2), (2, 5, 3), (2, 5, 4), (2, 5, 5), (3, 2, 2), (3, 2, 3), (3, 2, 4), (3, 2, 5), (3, 3, 2), (3, 3, 3), (3, 3, 4), (3, 3, 5), (3, 4, 2), (3, 4, 3), (3, 4, 4), (3, 4, 5), (3, 5, 2), (3, 5, 3), (3, 5, 4), (3, 5, 5), (4, 2, 2), (4, 2, 3), (4, 2, 4), (4, 2, 5), (4, 3, 2), (4, 3, 3), (4, 3, 4), (4, 3, 5), (4, 4, 2), (4, 4, 3), (4, 4, 4), (4, 4, 5), (4, 5, 2), (4, 5, 3), (4, 5, 4), (4, 5, 5), (5, 2, 2), (5, 2, 3), (5, 2, 4), (5, 2, 5), (5, 3, 2), (5, 3, 3), (5, 3, 4), (5, 3, 5), (5, 4, 2), (5, 4, 3), (5, 4, 4), (5, 4, 5), (5, 5, 2), (5, 5, 3), (5, 5, 4), (5, 5, 5)]
please input the test name: test
Traceback (most recent call last):
  File "main.py", line 248, in <module>
    main(args)
  File "main.py", line 40, in main
    train_model()
  File "main.py", line 81, in train_model
    envs = make_vec_envs(env_name, config.seed, config.num_processes, config.gamma, config.log_dir, device, False)
  File "/home/abc/Online-3D-BPP-DRL/acktr/envs.py", line 103, in make_vec_envs
    data_name = None)
TypeError: make() got an unexpected keyword argument '_adjust_ratio'
alexfrom0815 commented 3 years ago

We need to pass necessary information of the environment by 'gym.make()' when creating the environment,which means that you need not only declare the environment name in 'gym.make()', but also declare other necessary parameters of the environment. You can refer to 'Online-3D-BPP-DRL/acktr/envs.py/make_vec_envs()/gym.make(...)' to create the environment.

kashifzr commented 3 years ago

thanks The issue is resolve, the problem is due gym package. I just installed the required one