Coder Social home page Coder Social logo

grandpere / mario-gpt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shyamsn97/mario-gpt

0.0 0.0 0.0 2.26 MB

Generating Mario Levels with GPT2. Code for the paper "MarioGPT: Open-Ended Text2Level Generation through Large Language Models" https://arxiv.org/abs/2302.05981

Home Page: https://huggingface.co/shyamsn97/Mario-GPT2-700-context-length

License: MIT License

Python 77.32% Makefile 0.45% Jupyter Notebook 22.23%

mario-gpt's Introduction

MarioGPT: Open-Ended Text2Level Generation through Large Language Models

Paper HuggingFace Spaces

alt text


How does it work?

alt text

MarioGPT is a finetuned GPT2 model (specifically, distilgpt2), that is trained on a subset Super Mario Bros and Super Mario Bros: The Lost Levels levels, provided by The Video Game Level Corpus. MarioGPT is able to generate levels, guided by a simple text prompt. This generation is not perfect, but we believe this is a great first step more controllable and diverse level / environment generation.

Requirements

  • python3.8+

Installation

from pypi

pip install mario-gpt

or from source

git clone [email protected]:shyamsn97/mario-gpt.git
python setup.py install

Generating Levels

Since our models are built off of the amazing transformers library, we host our model in https://huggingface.co/shyamsn97/Mario-GPT2-700-context-length

This code snippet is the minimal code you need to generate a mario level!

from mario_gpt.lm import MarioLM
from mario_gpt.utils import view_level, convert_level_to_png

# pretrained_model = shyamsn97/Mario-GPT2-700-context-length

mario_lm = MarioLM()

prompts = ["many pipes, many enemies, some blocks, high elevation"]

# generate level of size 700
generated_level = mario_lm.sample(
    prompts=prompts,
    num_steps=699,
    temperature=2.0,
    use_tqdm=True
)

# show string list
view_level(generated_level, mario_lm.tokenizer)
...
See notebook for a more in depth tutorial to generate levels

Future Plans

Here's a list of some stuff that will be added to the codebase!

  • Basic inference code
  • Add MarioBert Model
  • Inpainting functionality from paper
  • Open-ended level generation code
  • Training code from paper
  • Different generation methods (eg. constrained beam search, etc.)

Authors

Shyam Sudhakaran [email protected], https://github.com/shyamsn97

Miguel González-Duque [email protected], https://github.com/miguelgondu

Claire Glanois [email protected], https://github.com/claireaoi

Matthias Freiberger [email protected], https://github.com/matfrei

Elias Najarro [email protected], https://github.com/enajx

Sebastian Risi [email protected], https://github.com/sebastianrisi

Citation

If you use the code for academic or commecial use, please cite the associated paper:

@misc{https://doi.org/10.48550/arxiv.2302.05981,
  doi = {10.48550/ARXIV.2302.05981},
  
  url = {https://arxiv.org/abs/2302.05981},
  
  author = {Sudhakaran, Shyam and González-Duque, Miguel and Glanois, Claire and Freiberger, Matthias and Najarro, Elias and Risi, Sebastian},
  
  keywords = {Artificial Intelligence (cs.AI), Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
  
  title = {MarioGPT: Open-Ended Text2Level Generation through Large Language Models},
  
  publisher = {arXiv},
  
  year = {2023},
  
  copyright = {arXiv.org perpetual, non-exclusive license}
}

mario-gpt's People

Contributors

shyamsn97 avatar chayim avatar grandpere avatar osanseviero avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.