huggingface / huggingface_sb3

Additional code for Stable-baselines3 to load and upload models from the Hub.
77 stars 23 forks source link

Error when package_to_hub() method is called #31

Closed GEMCorp closed 1 year ago

GEMCorp commented 1 year ago

AssertionError: The render_mode must be 'rgb_array', not None It appears the render_mode is not set in the original method image When I try setting it in the function call, I get a TypeError: package_to_hub() got an unexpected keyword argument 'render_mode' image

simoninithomas commented 1 year ago

Hey there 👋 which environment did you used and library version? We currently updating the huggingface_sb3 package.

GEMCorp commented 1 year ago

This particular one is from the hands-on for unit 6. Both environments AntBulletEnv-v0 and PandaReachDense-v2 were used. The library version was as provided by default (that is huggingface_sb3).

simoninithomas commented 1 year ago

Thanks for the info, we just updated the Unit 6 and SB3 integration so it should work correctly now 🤗

pmitros commented 3 months ago

@simoninithomas FYI: I currently get the same error on unit 1.

---> 50         assert self.env.render_mode == "rgb_array", f"The render_mode must be 'rgb_array', not {self.env.render_mode}"
     51 
     52         self.record_video_trigger = record_video_trigger

AssertionError: The render_mode must be 'rgb_array', not None

Both running locally and on colab.

I'll mention: What's more annoying than the error is the lack of meaningful ways to debug and fix things myself. As package_to_hub is structured:

  1. It's hard to execute step-by-step and dive into where it fails (or pick up from after failure)
  2. It's not very configurable. The first time I used it locally, it failed to generate the video, and made a bad push. I understand you changed it from stop-on-failure to run-on-failure due to a prior issue, but the behavior you want is stop-on-failure with a way to resume or with a way to override with a parameter

A comment like this one also don't explain the issue and don't point back to the PR which fixed it, so I can't do the same on unit 1 myself.

Minimum failing version:

https://gist.github.com/pmitros/cfd9c2a695db59976f06c7d0508c4140

I've tweaked things there a fair bit too, and all tweaks lead to some error.

I've run into a bunch of issues along the way, many with online explanations for how to fix them. A really nice thing, for a lesson, is for exceptions to be caught and to give meaningful errors (e.g. if video recording fails, mention "You may need to restart the system after installing pyvirtualdisplay", or better yet, check versions of libraries in the exception handler). The current issue I'm running into is that if I save a model, leave, come back, and reload it, performance goes down by a lot (e.g. from working ≈200 to -500). There's also a version issue with gymnasium between several dependencies (shimmy in particular).

Thank you for putting together these courses.