Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ NCA Public

Jax implementation of the Neural Cellular Automata (NCA) algorithm

howaboutyu/NCA

Repository files navigation

pytest Code style: black


A Jax implementation of Neural Cellular Automata
NCA

📝 Table of Contents

🧐 About

This project presents a Jax implementation of the Neural Cellular Automata (NCA) algorithm, based on the concepts outlined in the Distill paper Growing Neural Cellular Automata. While the original implementation was developed using Tensorflow, this project serves as a re-implementation specifically tailored for Jax.

🏁 Getting Started

These instructions will get you setup to train the model on your local machine, preferably with a GPU.

Installing

Without docker

To install Jax refer to the Jax documentation

Install the other dependencies with pip

pip install -r requirements.txt

With GPU docker (recommended)

To build the Docker image and attach to it, run the following commands:

sudo make docker-build

# Attach to the docker container
sudo make start-devel

This docker is based on the nvcr.io/nvidia/tensorflow:22.09-tf2-py image. It has CUDA 11.8 and cuDNN 8.6, ensure that you satisfy the driver requirements.

🔧 Running the tests

To verify if everything is installed correctly, you can run the following command to perform tests using pytest:

pytest

🎈 Usage

Training

To train the model run the following command

python main.py --config configs/growing_nca.yaml 

Configuration settings can be defined using YAML files. The default configuration file to reproduce the results mentioned in the paper can be found at configs/growing_nca_with_damage.yaml. For all the default configurations, please refer to nca/configs.py.

To specify your own target image, you can modify the target_filename field in the YAML file to the desired image filename. Please ensure that the image has an alpha channel.

Inference

To perform inference on a trained model, execute the following command.

python main.py --config_path=configs/growing_demo.yaml --mode=evaluate --output_video_path=demo.mp4
2023

Please ensure that you update the weights_dir field in the configuration file with the accurate path to the downloaded checkpoint. Additionally, specify the output_video_path to determine the location where the NCA propagation will be saved in video format.

🔖 Checkpoints

Checkpoint Description
checkpoint_squinting_face_with_tongue Squinting face with tongue model 😝

About

Jax implementation of the Neural Cellular Automata (NCA) algorithm

Resources

Stars

Watchers

Forks

Packages

No packages published