Build a Custom Gymnasium Reinforcement Learning Environment & Train w Q-Learning & Stable Baselines3

Ғылым және технология

End-to-end tutorial on creating a very simple custom Gymnasium-compatible (formerly, OpenAI Gym) Reinforcement Learning environment and then test it using both Q-Learning and the Stable Baselines3 library.
Get the code: github.com/johnnycode8/gym_cu...
Buy Me a Coffee: www.buymeacoffee.com/johnnycode
Gymnasium Tutorials: • Gymnasium (Deep) Reinf...
00:00 Custom RL Env Approach
00:43 Model the Problem for RL
03:47 Build Custom Gym Env
04:25 Register the Custom Gym Env
04:58 Inherit gym.env
05:06 Define Metadata rendor_modes rendor_fps
06:02 Define Action Space using spaces.Discrete
07:30 Define Observation Space using spaces.Box
09:17 Implement reset function
10:28 Implement step function
12:15 Implement render function
12:47 Validate Custom Gym Env with check_env
15:22 Train with Q-Learning
18:38 Train with Stable Baselines3

Пікірлер: 21

  • @a_samad
    @a_samad3 ай бұрын

    Thank You!🎉 We need more videos (course) like that: create custom env using open ai gym.

  • @navaneethbuilds
    @navaneethbuilds15 күн бұрын

    thanks for the amazing video

  • @Ayhamtechtips
    @Ayhamtechtips3 ай бұрын

    Very helpful and nice explanation. Thanks!

  • @buzzbuzz1691
    @buzzbuzz16914 ай бұрын

    Thank you

  • @hrsharma02
    @hrsharma022 ай бұрын

    Thanks, dear 🎉, Please upload more videos on multi-agent RL for robotics and path planning for multi-robot with custom environment in Gymnasium.

  • @ashutoshmishra5901
    @ashutoshmishra59013 ай бұрын

    Your Explanation is too good. I have a humble request. Can you make RL training using MuJoCo Ant but registering it as custom environment. The GAIT parameter generation is quite treaky. If possible please make a tutorial on it.

  • @towerboi-zg3it

    @towerboi-zg3it

    3 ай бұрын

    I also want this tutorial, so please Johnny

  • @tieqi5623
    @tieqi56232 ай бұрын

    Thanks, good video. Dose Gymnasium can support NeoGeo (SNK) roms? How to make it to support?

  • @johnnycode

    @johnnycode

    2 ай бұрын

    It doesn’t support Neo Geo roms. I think it would be extremely hard to bridge that support.

  • @user-pg7bs4mu5l
    @user-pg7bs4mu5lАй бұрын

    Thanks for your video. Which ressources would you adivse to learn practical applications of reinforcement learning? I've been trying to implement a bot for a specific game and have to create my own environment and DQN. I'm familiar with neural nets, but all the rest is so hard to find good information on

  • @johnnycode

    @johnnycode

    Ай бұрын

    Sorry, I'm not an expert. I suggest inquiring at the r/reinforcementlearning subreddit. There are some very knowledgeable people there.

  • @user-pg7bs4mu5l

    @user-pg7bs4mu5l

    Ай бұрын

    @@johnnycode Thank you for the answer, will do!

  • @rickyolal
    @rickyolal29 күн бұрын

    Hey Johnny, I was wondering if you knew how to make the algorithm learn some already known states? I have a challenge related to make a DQN learn and start with already known states stored in a csv file, and I am struggling because I have no idea how to do that. Is it possible?

  • @johnnycode

    @johnnycode

    29 күн бұрын

    I'm guessing if you know those states, then you would know what action to take or not take in relation to those states. For example, a pawn on a chess board can't go backwards, since you know that state is impossible. If my interpretation of your question is correct, then you might want to look into "action masking", which prevents the agent from taking illegal actions. You can start with this SB3 reference, but the concept is not limited to PPO: sb3-contrib.readthedocs.io/en/master/modules/ppo_mask.html

  • @arnavmodanwal6295
    @arnavmodanwal6295Ай бұрын

    Hi, your videos are great and helped me a lot since you were using the latest version of stable baseline3...But I am facing an issue that the verbose values are not getting printed in output I have put verbose = 1 and even tried to use verbose = 2 but not getting the desired outputs (like rewards, loss, iterations, ep_len_mean etc.) as it was getting printed in your videos. Can you please help me? Is this due to the custom environment I am using or something else? Also, tensorboard logs are also not working...

  • @johnnycode

    @johnnycode

    Ай бұрын

    You should try creating a new conda environment and then install SB3 again. In my SB3 introduction video, I just ran pip install stable-baselines3[extra] and didn't do anything else special: kzread.info/dash/bejne/gaWquqqij7TahJM.html

  • @arnavmodanwal6295

    @arnavmodanwal6295

    Ай бұрын

    @@johnnycode Hi, I will try this one again...Thanks a lot for the reply and your time! Might need your help again...

  • @arnavmodanwal6295

    @arnavmodanwal6295

    Ай бұрын

    Hi, @johnnycode, I tried reinstalling the stable-baselines3[extras] but I am not getting the monitor data also the tensorboard logs are also not getting displayed...Is there some issue with the new version of stable-baselines3[extra] can you please give me the version you installed when making the video?

  • @johnnycode

    @johnnycode

    29 күн бұрын

    stable-baselines3 2.0.0 tensorboard 2.13.0

  • @sergiogirona2988
    @sergiogirona29883 ай бұрын

    Could i use it for own game made it with Godot Engine?? Thanks!!

  • @johnnycode

    @johnnycode

    3 ай бұрын

    Yes, of course!

Келесі