Skip to content

harikris001/Super-mario-Reinforcement-Learning-V2

Repository files navigation

[PYTORCH] Reinforcement Learning-Super Mario Bros Using MLP policy

This is the second attempt to crack the game of super mario bros. Earlier i hace already tried using CNNpolicy. But the Agent was not able to complete the level and the training time was largely high

So i decide to take a new crack at the problem

Older Project: Repo Link

Packages Used:

  • gym-super-mario-Bros == 7.3.0
  • gym == 0.21.0
  • ipykernal
  • Stable-Baselines3
  • Pytorch 1.13

Setting Up Pytorch

I would recoomend you to check official Pytorch website to install it
The Pytorch need the exact version of Cuda to work normally
Pytorch website: pytorch

Creating Virtual Environment:

setting up a virtual environment will really help in Creating a seperatiion wwithin your workspace and PC
Run following to create a virtual environment

  • launch cmd
  • move to your desired directory
  • Run the following: python -m venv ppo activate your virtual env using following:
    .\ppo\Scripts\activate
    to deactivte just type deactivate in cmd

Installing all libraries

To install all the libraries that are necessary for the projet in your cmd after activating environment run the command
pip install -r requirments.txt

Creating a New kernel in Jupyter Notebook

After installing Ipykernal run the following:
python -m ipykernel install --user --name=ppo

note: the name of kernel should be same as venv name

Training the Agent

Either clone my repo or download the zip or copy paste the code and run them
Github clone Link: https://github.com/harikris001/Super-mario-Reinforcement-Learning-V2.git
Run the cells and wait for it to complete.

After Training:

The training time was largely reduced comparing the previous project
the agent was also able to complete the level
Level 1 Output:
OUTPUT:
Steps 8M
Completed True

I have attached the Pre trained models if u want to test them
Some other Models are also Attached but they have not completed the levels



About

Reinforcement Learning for Super Mario Bros game using PPO

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published