GithubHelp home page GithubHelp logo

hanchyhill / difftaichi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from taichi-dev/difftaichi

0.0 0.0 0.0 529 KB

10 differentiable physical simulators built with Taichi differentiable programming (DiffTaichi, ICLR 2020)

difftaichi's Introduction

python3 diffmpm.py

DiffTaichi: Differentiable Programming for Physical Simulation (ICLR 2020)

Yuanming Hu, Luke Anderson, Tzu-Mao Li, Qi Sun, Nathan Carr, Jonathan Ragan-Kelley, Frédo Durand

[Paper] [Video] (with instructions to reproduce every demo)

Differentiable programming in Taichi allows you to optimize neural network controllers efficiently with brute-force gradient descent, instead of using reinforcement learning.

The DiffTaichi differentiable programming framework is now officially part of Taichi. This repo only contains examples.

DiffTaichi significantly boosts the performance and productivity of differentiable physical simulators. For example, the differentiable elastic object simulator (ChainQueen) in DiffTaichi is 188x faster than an implementation in TensorFlow. The DiffTaichi version also runs as fast as the CUDA implementation, with the code being 4.2x shorter.

Most of the 10 differentiable simulators can be implemented within 2-3 hours.

Questions regarding the simulators/autodiff compiler go to Yuanming Hu (yuanming at mit.edu) or Issues.

Note: please make sure you are using Taichi >= v0.6.32.

On August 14 2020, some non-example scripts under examples were moved to examples/misc. These scripts are used to generate figures in the paper, and will not be updated with Taichi anymore. If you want to run them, please try to use taichi==0.6.41.

How to run

Step 1: Install Taichi with pip:

(Most examples do not need a GPU to run.)

python3 -m pip install taichi

Step 2: Run example scripts in the examples folder: (Please wait for all GIFs to load :-)

Differentiable Elastic Object Simulator [python3 diffmpm.py]

Gradient descent iteration 0 and gradient descent iteration 80:

Differentiable 3D Elastic Object Simulator [python3 diffmpm3d.py]

Gradient descent iteration 40:

Differentiable 3D Fluid Simulator [python3 liquid.py]

Gradient descent iteration 450:

Differentiable Height Field Water Simulator [python3 wave.py]

Gradient descent iteration 180:

Differentiable (Adversarial) Water Renderer [python3 water_renderer.py]

Differentiable water simulation + differentiable water rendering + (differentiable) CNN

Optimization goal: find an initial water height field, so that after simulation and shading, VGG16 thinks the squirrel image is a goldfish. Input image: VGG16=fox squirrel (42.21%)

Left: center activation . Right: An activation that fools VGG (VGG16=goldfish (99.91%))

Differentiable Rigid Body Simulator [python3 rigid_body.py [1/2] train]

2048 time steps. Gardient descent iteration 20:

Differentiable Mass-Spring Simulator [python3 mass_spring.py [1/2/3] train]

682 time steps. Gardient descent iteration 20:

Differentiable Billiard Simulator [python3 billiards.py]

Gardient descent iteration 0 and gradient descent iteration 100:

See the video for the remaining two simulators.

Bibtex

@article{hu2019difftaichi,
  title={DiffTaichi: Differentiable Programming for Physical Simulation},
  author={Hu, Yuanming and Anderson, Luke and Li, Tzu-Mao and Sun, Qi and Carr, Nathan and Ragan-Kelley, Jonathan and Durand, Fr{\'e}do},
  journal={ICLR},
  year={2020}
}
@article{hu2019taichi,
  title={Taichi: a language for high-performance computation on spatially sparse data structures},
  author={Hu, Yuanming and Li, Tzu-Mao and Anderson, Luke and Ragan-Kelley, Jonathan and Durand, Fr{\'e}do},
  journal={ACM Transactions on Graphics (TOG)},
  volume={38},
  number={6},
  pages={201},
  year={2019},
  publisher={ACM}
}

difftaichi's People

Contributors

yuanming-hu avatar samuela avatar domnomnom avatar ehannigan avatar md2perpe avatar coffeiersama avatar squarefk avatar archibate 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.