jannerm / trajectory-transformer

Code for the paper "Offline Reinforcement Learning as One Big Sequence Modeling Problem"
https://trajectory-transformer.github.io
MIT License
464 stars 65 forks source link

KeyError: 'halfcheetah-medium-v2' #6

Closed GromShine closed 2 years ago

GromShine commented 2 years ago

Dear author,

After installation and downloading pretrained models&plans, I still get in trouble with running the command. python scripts/train.py --dataset halfcheetah-medium-v2

(trajectory) qz@qz:~/trajectory-transformer$ python scripts/train.py --dataset halfcheetah-medium-v2

[ utils/setup ] Reading config: config.offline:halfcheetah_medium_v2 [ utils/setup ] Not using overrides | config: config.offline | dataset: halfcheetah_medium_v2 [ utils/setup ] Made savepath: logs/halfcheetah-medium-v2/gpt/azure [ utils/setup ] Saved args to logs/halfcheetah-medium-v2/gpt/azure/args.json Traceback (most recent call last): File "/home/qz/anaconda3/envs/trajectory/lib/python3.6/site-packages/gym/envs/registration.py", line 121, in spec return self.env_specs[id] KeyError: 'halfcheetah-medium-v2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "scripts/train.py", line 25, in env = datasets.load_environment(args.dataset) File "/home/qz/trajectory-transformer/trajectory/datasets/d4rl.py", line 81, in load_environment wrapped_env = gym.make(name) File "/home/qz/anaconda3/envs/trajectory/lib/python3.6/site-packages/gym/envs registration.py", line 145, in make return registry.make(id, kwargs) File "/home/qz/anaconda3/envs/trajectory/lib/python3.6/site-packages/gym/envs/registration.py", line 89, in make spec = self.spec(path) File "/home/qz/anaconda3/envs/trajectory/lib/python3.6/site-packages/gym/envs/registration.py", line 131, in spec raise error.UnregisteredEnv('No registered env with id: {}'.format(id)) gym.error.UnregisteredEnv: No registered env with id: halfcheetah-medium-v2**

Thank you very much for your attention.

jannerm commented 2 years ago

halfcheetah-medium-v2 should be registered upon importing d4rl. Could you post your output of:

python -c "import gym, d4rl; print(d4rl); gym.make('halfcheetah-medium-v2')"
GromShine commented 2 years ago

halfcheetah-medium-v2 should be registered upon importing d4rl. Could you post your output of:

python -c "import gym, d4rl; print(d4rl); gym.make('halfcheetah-medium-v2')"

(base) qz@qz~$ python -c "import gym, d4rl; print(d4rl); gym.make('halfcheetah-medium-v2')" Warning: Flow failed to import. Set the environment variable D4RL_SUPPRESS_IMPORT_ERROR=1 to suppress this message. No module named 'flow.envs' Segmentation Fault (“Core dumped”)

At first, it told me no module named 'CARLA' and no module named 'flow' Then, I installed 'CARLA' & 'flow', and now it tells me no module named 'flow.envs'

Thank you very much for your attention.

jannerm commented 2 years ago

It sounds like a D4RL installation issue. Running with Docker via these commands should solve it. Alternatively, you could post this stack trace as an issue to the D4RL repo to see if they have seen this before. My guess is that the segfault is unrelated to lacking the CARLA and flow environments; those are probably just installed as separate optional packages.