huggingface/deep-rl-class

[HANDS-ON BUG]AttributeError: 'dict' object has no attribute 'env_specs'

1995lb opened this issue · 9 comments

1995lb commented

Describe the bug

A bug happens when i try to upload my model to hub,the error just likes this:
22 eval_env = DummyVecEnv([lambda: Monitor(gym.make(env_id, render_mode="rgb_array"))])
---> 24 package_to_hub(
26 model=model,
28 model_name=model_name,
30 model_architecture=model_architecture,
32 env_id=env_id,
34 eval_env=eval_env,
36 repo_id=repo_id,
37 commit_message=commit_message,
38 )

File /opt/conda/lib/python3.10/site-packages/huggingface_sb3/push_to_hub.py:366, in package_to_hub(model, model_name, model_architecture, env_id, eval_env, repo_id, commit_message, is_deterministic, n_eval_episodes, token, video_length, logs)
364 # Deterministic by default (except for Atari)
365 if is_deterministic:
--> 366 is_deterministic = not is_atari(env_id)
368 # Step 2: Create a config file
369 _generate_config(model_name, tmpdirname)

File /opt/conda/lib/python3.10/site-packages/huggingface_sb3/push_to_hub.py:104, in is_atari(env_id)
98 def is_atari(env_id: str) -> bool:
99 """
100 Check if the environment is an Atari one
101 (Taken from RL-Baselines3-zoo)
102 :param env_id: name of the environment
103 """
--> 104 entry_point = gym.envs.registry.env_specs[env_id].entry_point
105 return "AtariEnv" in str(entry_point)

AttributeError: 'dict' object has no attribute 'env_specs'

i have done some search,the version of gym may not match.

Material

  • Did you use Google Colab?

If not:
i am using kaggle, gpu T4

Hey there 👋 which hands on are you working on?

If you use huggingface_sb3 we didn't published the new release yet but you can install it using pip install git+https://github.com/huggingface/huggingface_sb3@gymnasium-v2

Edit, we published the new release you can install using pip install huggingface-sb3

1995lb commented

Edit, we published the new release you can install using pip install huggingface-sb3
Thanks,I will try it again.

facing same issue, working on unit 6, cpu windows, 64.

tried installing latest version of huggingface-sb3, did not work.

AttributeError: 'dict' object has no attribute 'env_specs'

short snippet of traceback

following git issue may help - openai/gym#3097

File [c:\Users\Admin\Desktop\work\huggingface\.conda\Lib\site-packages\huggingface_sb3\push_to_hub.py:104](file:///C:/Users/Admin/Desktop/work/huggingface/.conda/Lib/site-packages/huggingface_sb3/push_to_hub.py:104), in is_atari(env_id)
     98 def is_atari(env_id: str) -> bool:
     99     """
    100     Check if the environment is an Atari one
    101     (Taken from RL-Baselines3-zoo)
    102     :param env_id: name of the environment
    103     """
--> 104     entry_point = gym.envs.registry.env_specs[env_id].entry_point
    105     return "AtariEnv" in str(entry_point)

Which version of huggingface-sb3 you have?

Did not specify perticular version, so should pull latest 2.3

Hey there 👋 did you tried again with the update v3.0?