Skip to content

Radinyn/diffusion-snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Diffusion Snake

Inspired by DIAMOND

This is a diffusion model simulating Snake.

The idea is to take some previous frames and the user input to predict the next frame.

It was never explicitly taught any Snake rules.

Note that apples are nondeterministic!

Model in action:

IMAGE ALT TEXT HERE

SUPPORTED version (more info below):

IMAGE ALT TEXT HERE

To play:

Download diffuzer weights (best.pt) from here.

Save them at: snake/diffusion/models/best.pt

To run do:

python -m snake

Tweak the SUPPORTED parameter in __main__.py to take the median of 5 model outputs and regenerate apples if they disappear. This makes the game smoother.

To train:

# Train the RL Agent
python -m snake.agent.train # or use best_agent.pt

# Generate a dataset
python -m snake.dataset.dataset

# Train the diffuzer
python -m snake.diffusion.train

Training best_agent.pt agent took 14000 (short) epochs with learning rate 0.005.

Training best.ptdiffuzer took 15 epochs with learning rate 0.001 and additional 5 epochs with learning rate 0.0001.

About

Diffusion based Snake world model

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages