Build an Mario AI Model with Python | Gaming Reinforcement Learning

Nicholas Renotte · 183K views · 2021 · 1:17:06

Open on YouTube

Machine learning & deep learningGame programming & enginestutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the tutorial they were following when their Mario RL setup broke, including Colab display errors, an OverflowError in gym_super_mario_bros, and a Jupyter kernel failure.

Recommended by 0 people across 0 different months, 2022 to 2024.

What it is

A 77-minute hands-on tutorial by Nicholas Renotte that builds a reinforcement learning agent to play Super Mario Bros in Python. It covers setting up the gym-super-mario-bros environment, preprocessing with grayscale, vectorization and frame stacking, then training and running a PPO model with PyTorch and Stable Baselines3.

What people said

Cites Saad Mohammed · 2022-01 · Stack Overflow · on “How do i display the super mario environment on google colab”

done = True for step in range(100000): if done: env.reset() state, reward, done, info = env.step(env.action_space.sample()) env.render() env.close() when run this code i get this error AttributeError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/pyglet/__init__.py in __getattr__(self, name) 328 try: --> 329 return getattr(self._module, name) 330 except AttributeError: AttributeError: 'NoneType' object has no attribute 'key' During handling of the above exception, another exception occurred: NoSuchDisplayException Traceback (most recent call last) 11 frames /usr/local/lib/python3.7/dist-packages/pyglet/canvas/xlib.py in __init__(self, name, x_screen) 121 self._displ

Cites Timothy Bennett · 2023-12 · Stack Overflow · on “"The kernel failed to start due to an error with the 'pyzmq' module. Consider re-installing this module." error in VSCode”

I've been trying to import the module "gym_super_mario_bros" for a tutorial on youtube ( [this video] ). I'm using Jupyter in VSCode, but every time I press shift+enter to run the code: import gym_super_mario_bros I get the error The kernel failed to start due to an error with the 'pyzmq' module. Consider re-installing this module. I've tried reinstalling the pyzmq module about a few thousand times, but for some reason it still won't work.

Cites David Engel · 2024-07 · Stack Overflow · on “OverflowError When Setting Up gym_super_mario_bros Environment in Python on JupyterLab”

I’ve been following a tutorial on YouTube ( [this video] ) to build a Super Mario AI model using Python. However, when setting up the gym_super_mario_bros environment, I encounter an OverflowError. Here’s the code I’m using: # Import the game import gym_super_mario_bros # Import the Joypad wrapper from nes_py.wrappers import JoypadSpace # Import the SIMPLIFIED controls from gym_super_mario_bros.actions import SIMPLE_MOVEMENT # Setup game env = gym_super_mario_bros.make('SuperMarioBros-v0') env = JoypadSpace(env, SIMPLE_MOVEMENT) and this is the error: --------------------------------------------------------------------------- OverflowError Traceback (most recent call last) Cell In[3], line 2 1 #