huggingface / huggingface_sb3

Additional code for Stable-baselines3 to load and upload models from the Hub.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`FileNotFoundError` in `_generate_config`

thatgeeman opened this issue · comments

I am going through the notebook of Unit 1 of the deep RL course. However, I cannot run the package_to_hub function, which gives the following error:

FileNotFoundError                         Traceback (most recent call last)
[<ipython-input-65-5bae1f01b050>](https://localhost:8080/#) in <module>
----> 1 package_to_hub(model=model, # Our trained model
      2                model_name=model_name, # The name of our trained model
      3                model_architecture=model_architecture, # The model architecture we used: in our case PPO
      4                env_id=env_id, # Name of the environment
      5                eval_env=eval_env, # Evaluation Environment

2 frames
/usr/local/lib/python3.8/dist-packages/huggingface_sb3/push_to_hub.py 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)

/usr/local/lib/python3.8/dist-packages/huggingface_sb3/push_to_hub.py in _generate_config(model, local_path)

[/usr/lib/python3.8/zipfile.py](https://localhost:8080/#) in __init__(self, file, mode, compression, allowZip64, compresslevel, strict_timestamps)
   1249             while True:
   1250                 try:
-> 1251                     self.fp = io.open(file, filemode)
   1252                 except OSError:
   1253                     if filemode in modeDict:

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpqessnhko/ppo_model.sb3.zip'

push_to_hub works fine though.

It wasn’t anything serious, just figured that the model name should’ve been ppo_model instead of ppo_model.sb3. The extra dot was somehow confusing for (one of) the model.save/zipfile/package_to_hub methods. Closing!