Code for the paper "Planning with Diffusion for Flexible Behavior Synthesis"

Related tags

Hardwarediffuser
Overview

Planning with Diffusion    Open In Colab

Training and visualizing of diffusion models from Planning with Diffusion for Flexible Behavior Synthesis. Guided sampling code to come soon!

Quickstart

Load a pretrained diffusion model and sample from it in your browser with scripts/diffuser-sample.ipynb.

Installation

conda env create -f environment.yml
conda activate diffusion
pip install -e .

Usage

Train a diffusion model with:

python scripts/train.py --dataset hopper-medium-replay-v2 \
    --horizon 512 --n_diffusion_steps 200

The default hyperparameters are listed in config/locomotion.py. You can override any of them with runtime flags, eg --batch_size 64.

Docker

  1. Build the container:
docker build -f azure/Dockerfile . -t diffuser
  1. Test the container:
docker run -it --rm --gpus all \
    --mount type=bind,source=$PWD,target=/home/code \
    --mount type=bind,source=$HOME/.d4rl,target=/root/.d4rl \
    diffuser \
    bash -c \
    "export PYTHONPATH=$PYTHONPATH:/home/code && \
    python /home/code/scripts/train.py --dataset hopper-medium-expert-v2 --logbase logs/docker"

Running on Azure

Setup

  1. Launching jobs on Azure requires one more python dependency:
pip install git+https://github.com/JannerM/[email protected]
  1. Tag the image built in the previous section and push it to Docker Hub:
export DOCKER_USERNAME=$(docker info | sed '/Username:/!d;s/.* //')
docker tag diffuser ${DOCKER_USERNAME}/diffuser:latest
docker image push ${DOCKER_USERNAME}/diffuser
  1. Update azure/config.py, either by modifying the file directly or setting the relevant environment variables. To set the AZURE_STORAGE_CONNECTION variable, navigate to the Access keys section of your storage account. Click Show keys and copy the Connection string.

  2. Download azcopy: ./azure/download.sh

Usage

Launch training jobs with python azure/launch.py. The launch script takes no command-line arguments; instead, it launches a job for every combination of hyperparameters in params_to_sweep.

Viewing results

To rsync the results from the Azure storage container, run ./azure/sync.sh.

To mount the storage container:

  1. Create a blobfuse config with ./azure/make_fuse_config.sh
  2. Run ./azure/mount.sh to mount the storage container to ~/azure_mount

To unmount the container, run sudo umount -f ~/azure_mount; rm -r ~/azure_mount

Reference

@inproceedings{janner2022diffuser,
  title = {Planning with Diffusion for Flexible Behavior Synthesis},
  author = {Michael Janner and Yilun Du and Joshua B. Tenenbaum and Sergey Levine},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
}

Acknowledgements

The diffusion model implementation is based on Phil Wang's denoising-diffusion-pytorch repo. The organization of this repo and remote launcher is based on the trajectory-transformer repo.

Universal Xiaomi MIoT integration for Home Assistant

Xiaomi MIoT Raw 简体中文 | English MIoT 协议是小米智能家居从 2018 年起推行的智能设备通信协议规范,此后凡是可接入米家的设备均通过此协议进行通信。此插件按照 MIoT 协议规范与设备通信,实现对设备的状态读取及控制。

1.9k Jan 02, 2023
Brogrammer-keyboard - FIrmware for the Brogrammer Keyboard v1.0

Brogrammer Keyboard Firmware The package contains the firmware that runs on the Brogrammer Keyboard v1.0 See https://imgur.com/a/oY5QZ14 This keyboard

Devin Hartleben 1 Apr 21, 2022
2021 Real Robot Challenge Phase2 attemp

Real_Robot_Challenge_Phase2_AE_attemp We(team name:thriftysnipe) are the first place winner of Phase1 in 2021 Real Robot Challenge. Please see this pa

Qiang Wang 2 Nov 15, 2021
Ha-rpi gpio - Home Assistant Raspberry Pi GPIO Integration

Home Assistant Raspberry Pi GPIO custom integration This is a spin-off from the

Shay Levy 98 Dec 24, 2022
Pure micropython ESP32 SPI driver for sdcard and screen at the same SPI bus

micropython-esp32-spi-sdcard-and-screen-driver Proof of concept of Pure micropython espidf SPI driver for sdcard with screen at the same SPI bus (exam

Thomas Favennec 7 Mar 14, 2022
A simple small scale electric car was build which can be driven by remote control and features a fully autonomous parking procedure.

personal-autonomous-parking-car-raspberry A simple electric car model was build using Raspbery pi. The car has remote control and autonomous operation

Kostas Ziovas 2 Jan 26, 2022
Doughskript interpreter for converting simple command sequences into executable Arduino C++ code.

Doughskript interpreter for converting simple command sequences into executable Arduino C++ code.

Svjatoslav 2 Jan 11, 2022
emhass: Energy Management for Home Assistant

emhass EMHASS: Energy Management for Home Assistant Context This module was conceived as an energy management optimization tool for residential electr

David 70 Dec 24, 2022
Intel Realsense t265 into Unreal Engine

t265_UE Intel Realsense t265 into Unreal Engine. Windows only, and Livelink plugin is 4.26.2 only at the moment. Might recompile it for different vers

Bjarke Aagaard 30 Jan 02, 2023
Final-project-robokeeper created by GitHub Classroom

RoboKeeper! Jonny Bosnich, Joshua Cho, Lio Liang, Marco Morales, Cody Nichoson Demonstration Videos Grabbing the paddle: https://youtu.be/N0HPvFNHrTw

Cody Nichoson 1 Dec 12, 2021
a library for using WS2812b leds (aka neopixels) with Raspberry Pi Pico

pico_ws2812b a library for using WS2812b leds (aka neopixels) with Raspberry Pi Pico You'll first need to save the ws2812b.py file to your device (for

76 Nov 25, 2022
A Fast, Easy, and User Friendly way to control Robotics Actuators.

T-Motor Controller A Fast, Easy, and User Friendly way to control Robotics Actuators. View Demo · Report Bug · Request Feature Table of Contents About

26 Aug 23, 2022
PlatformIO development platform for GSM modules

PlatformIO development platform for GSM modules Supported Modules Quectel M66 OpenCPU Arduino - TODO other - in progress... Supported Boards Comet M66

Georgi Angelov 5 Aug 06, 2022
Programmable Rainbow Redstone Computer

Programmable Rainbow Redstone Computer Table of contents What is it? Program flasher How to use it What is it? PRRC is Programmable Rainbow Redstone C

Fern H 2 Jun 07, 2022
Example code to sending USB Gadget multimedia keys via Python

Send Multimedia USB HID Keys via Python As an USB Gadget in Linux This gives a simple script with zero dependencies that can easily run on any Linux d

DevOps Nirvana 2 Jan 02, 2023
An open source two key macro-pad modeled to look like a cartoony melting popsicle

macropopsicle An open source two key macro-pad modeled to look like a cartoony melting popsicle. Build instructions Parts List -1x Top case half (3D p

17 Aug 18, 2022
A modular sequencer based on Pi Pico & EuroPi

PicoSequencer A modular sequencer based on Pi Pico & EuroPi by Zeno Van Moerkerke / Keurslager Kurt For now it is 'only' a trigger sequencer, but I si

5 Oct 27, 2022
A python script for Homeassistant that counts down the days to birthdays, anniversaries etc

Date Countdown A python script for Homeassistant that counts down the days to birthdays, anniversaries etc Important note I no longer use homeassistan

Marc Forth 21 Mar 12, 2022
Home Assistant custom components MPK-Lodz

MPK Łódź sensor This sensor uses unofficial API provided by MPK Łódź. Configuration options Key Type Required Default Description name string False MP

Piotr Machowski 3 Nov 01, 2022
What if home automation was homoiconic? Just transformations of data? No more YAML!

radiale what if home-automation was also homoiconic? The upper or proximal row contains three bones, to which Gegenbaur has applied the terms radiale,

Felix Barbalet 21 Mar 26, 2022