https://github.com/cheryyunl/make-an-agent

https://github.com/cheryyunl/make-an-agent

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.4%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: cheryyunl
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 9.57 MB
Statistics
  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • Open Issues: 1
  • Releases: 0
Created almost 2 years ago · Last pushed almost 2 years ago
Metadata Files
Readme License

README.md

Make-An-Agent: A Generalizable Policy Network Generator with Behavior-Prompted Diffusion

[Paper][Project Website]

This repository is the official PyTorch implementation of Make-An-Agent. Make-An-Agent, a policy parameter generator that leverages the power of conditional diffusion models for behavior-to-policy generation, which demonstrates remarkable versatility and scalability on multiple tasks and has a strong generalization ability on unseen tasks to output well-performed policies with only few-shot demonstrations as inputs.



💻 Installation

  1. create a virtual environment and install all required packages. bash conda env create -f environment.yml conda activate makeagent

  2. install Metaworld and mujoco_py for evaluations. Following instructions in DrM.

🛠️ Code Usage

For training autoencoder and behavior embedding, you could download the training dataset from Huggingface: train_data/training_dataset.pt or specific data for each task, e.g. train_data/door-open.pt.

Training the parameter autoencoder to encode and decode policy network parameters: Change data_root in autoencoder/config.yaml. bash cd autoencoder python train.py

Training behavior embeddings to process trajectory data: Change data_root in behavior_embedding/config_embed.yaml. bash cd behavior_embedding python train.py

Training the policy generator with conditional diffusion models:

Data processing:

Make-An-Agent uses a latent diffusion model, so the data should be processed using the autoencoder and behavior embedding.

You can directly use the pretrained models in HuggingFace.

Or use the processed training data in train_data/process_data.pt to train the policy generator.

If you want to process your own data, change the paths of data and pretrained model root in dataset/config.yaml. bash cd dataset.py python process_data.py

Ensure you now have processed data to match the latent representation dimensions, then change data_root in PolicyGenerator/config.yaml with your processed data. bash cd PolicyGenerator python train.py

Tips: We save both the best model and the last model during training.

Evaluating the synthesized parameters:

First we need to decode the latent parameters into policy parameters. Then deploy synthesized policy networks in the simulator.

We provide the processed test data in test_data/processed/. You also can process your test data using dataset/process_data.py.

Change ckpt_dir, encoder_dir and data_dir in PolicyGenerator/config.yaml. bash cd PolicyGenerator python eval.py

📗 Dataset and Pretrained Models

We release all pretrain models and data in Huggingface.

Pretrained models: Include autoencoder.pt, behavior_embedding.pt and model-best.pt.

Dataset: Training data is in train_data/ and test data is in test_data/

📝 Citation

If you find our work or code useful, please consider citing as follows:

@article{liang2024make, title={Make-An-Agent: A Generalizable Policy Network Generator with Behavior-Prompted Diffusion}, author={Liang, Yongyuan and Xu, Tingqiang and Hu, Kaizhe and Jiang, Guangqi and Huang, Furong and Xu, Huazhe}, journal={arXiv preprint arXiv:2407.10973}, year={2024} }

🌷 Acknowledgement

Our work is primarily based on the following projects: Diffusion Policy, pytorch-lightning, Metaworld, Robosuite, walk-these-ways. We thank these authors for their contributions to the open-source community.

For any questions or suggestions, please contact Yongyuan Liang.

Owner

  • Name: Cheryl Liang
  • Login: cheryyunl
  • Kind: user
  • Location: Toronto

Reinforcement Learning, Interactive Learning System

GitHub Events

Total
  • Watch event: 15
  • Fork event: 1
Last Year
  • Watch event: 15
  • Fork event: 1

Dependencies

environment.yml pypi
  • frozenlist ==1.4.1
  • fsspec ==2024.3.1
  • future ==1.0.0
  • gdown ==5.2.0
  • gitdb ==4.0.11
  • gitpython ==3.1.43
  • glfw ==1.12.0
  • gputil ==1.4.0
  • grpcio ==1.63.0
  • gym ==0.23.0
  • gym-notices ==0.0.8
  • gymnasium ==1.0.0a2
  • gymnasium-notices ==0.0.1
  • h5py ==3.11.0
  • huggingface-cli ==0.1
  • huggingface-hub ==0.23.0
  • hydra ==2.5
  • hydra-core ==1.1.1
  • hydra-submitit-launcher ==1.1.5
  • ipdb ==0.13.13
  • lightning-utilities ==0.11.2
  • metaworld ==0.0.0
  • monotonic ==1.6
  • mujoco ==2.3.0
  • mujoco-py ==2.1.2.14
  • multidict ==6.0.5
  • numpy ==1.24.4
  • omegaconf ==2.1.2
  • python-dateutil ==2.9.0.post0
  • pytorch-lightning ==2.2.4
  • tensorboard ==2.14.0
  • tensorboard-data-server ==0.7.2
  • tensorboardx ==2.6.2.2
  • termcolor ==2.4.0
  • tomli ==2.0.1
  • torch ==1.13.0
  • torchaudio ==0.13.0
  • torchinfo ==1.8.0
  • torchmetrics ==1.4.0
  • torchvision ==0.14.0