huggingface / deep-rl-class

This repo contains the syllabus of the Hugging Face Deep Reinforcement Learning Course.
Apache License 2.0
3.71k stars 564 forks source link

[HANDS-ON BUG] #509

Closed ADG4050 closed 1 week ago

ADG4050 commented 3 months ago

Describe the bug

The push to hub doesnt work for Unit 2 Taxi-v3, while it worked for the frozen lake environment in the same notebook. The cell runs for 20 mins and then the RAM crashes. There is no error in the running of the cell command.

https://colab.research.google.com/github/huggingface/deep-rl-class/blob/main/notebooks/unit2/unit2.ipynb#scrollTo=dhQtiQozhOn1

Material

If not:

simoninithomas commented 2 months ago

Hey there 👋 I just tested and it works correctly do you have still this issue?

zyl-hub commented 1 month ago

error while running push_to_hub in unit 2 Part 1: Frozen Lake ⛄ (non slippery version)

/usr/local/lib/python3.10/dist-packages/gymnasium/envs/toy_text/frozen_lake.py:328: UserWarning: WARN: You are calling render method without specifying any render mode. You can specify the render_mode at initialization, e.g. gym.make("FrozenLake-v1", render_mode="rgb_array")
  gym.logger.warn(

---------------------------------------------------------------------------

ValueError                                Traceback (most recent call last)

[<ipython-input-106-2c49e77fdc00>](https://localhost:8080/#) in <cell line: 3>()
      1 username = "enchan1" # FILL THIS
      2 repo_name = "q-FrozenLake-v1-4x4-noSlippery"
----> 3 push_to_hub(
      4     repo_id=f"{username}/{repo_name}",
      5     model=model,

3 frames

[<ipython-input-103-8afd6b7fcdc5>](https://localhost:8080/#) in push_to_hub(repo_id, model, env, video_fps, local_repo_path)
    117     # Step 6: Record a video
    118     video_path = repo_local_path / "replay.mp4"
--> 119     record_video(env, model["qtable"], video_path, video_fps)
    120 
    121     # Step 7. Push everything to the Hub

[<ipython-input-102-612cbd9d56e8>](https://localhost:8080/#) in record_video(env, Qtable, out_directory, fps)
     19     img = env.render()
     20     images.append(img)
---> 21   imageio.mimsave(out_directory, [np.array(img) for i, img in enumerate(images)], fps=fps)

[/usr/local/lib/python3.10/dist-packages/imageio/v2.py](https://localhost:8080/#) in mimwrite(uri, ims, format, **kwargs)
    493     imopen_args["legacy_mode"] = True
    494     with imopen(uri, "wI", **imopen_args) as file:
--> 495         return file.write(ims, is_batch=True, **kwargs)
    496 
    497 

[/usr/local/lib/python3.10/dist-packages/imageio/core/legacy_plugin_wrapper.py](https://localhost:8080/#) in write(self, ndimage, is_batch, metadata, **kwargs)
    240 
    241                 if image.ndim < 2:
--> 242                     raise ValueError(
    243                         "The image must have at least two spatial dimensions."
    244                     )

ValueError: The image must have at least two spatial dimensions.

need your help please

simoninithomas commented 1 month ago

Hey there 👋 , can you provide your colab so that I can test what's wrong?