/pyro

Deep universal probabilistic programming with Python and PyTorch

Primary LanguagePythonOtherNOASSERTION


Build Status codecov.io Latest Version Documentation Status

Getting Started | Documentation | Community | Contributing

Pyro is a flexible, scalable deep probabilistic programming library built on PyTorch. Notably, it was designed with these principles in mind:

  • Universal: Pyro is a universal PPL -- it can represent any computable probability distribution.
  • Scalable: Pyro scales to large data sets with little overhead compared to hand-written code.
  • Minimal: Pyro is agile and maintainable. It is implemented with a small core of powerful, composable abstractions.
  • Flexible: Pyro aims for automation when you want it, control when you need it. This is accomplished through high-level abstractions to express generative and inference models, while allowing experts easy-access to customize inference.

Pyro is in an alpha release. It is developed and used by Uber AI Labs. For more information, check out our blog post.

Installing

Installing a stable Pyro release

First install PyTorch.

Install via pip:

Python 2.7.*:

pip install pyro-ppl

Python 3.5:

pip3 install pyro-ppl

Install from source:

git clone git@github.com:uber/pyro.git
cd pyro
git checkout master  # master is pinned to the latest release
pip install .

Install with extra packages:

pip install pyro-ppl[extras]  # for running examples/tutorials

Installing Pyro dev branch

For recent features you can install Pyro from source.

To install a compatible CPU version of PyTorch on OSX / Linux, you could use the PyTorch install helper script.

bash scripts/install_pytorch.sh

Alternatively, build PyTorch following instructions in the PyTorch README.

git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
git checkout 200fb22  # <---- a well-tested commit

On Linux:

python setup.py install

On OSX:

MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install

Finally install Pyro

git clone https://github.com/uber/pyro
cd pyro
pip install .

Installing Pyro's branch tracking PyTorch 1.0 release

To use Pyro features that are under active development and only available with the PyTorch's forthcoming 1.0 release e.g. JIT compilation, you will need to use the pytorch-1.0 branch of Pyro.

First install the PyTorch release candidate using the Preview tab from the PyTorch website. Alternatively, you could build PyTorch following instructions in the PyTorch README.

Then, install Pyro using the pytorch-1.0 branch.

Install using pip:

pip install git+https://github.com/uber/pyro.git@pytorch-1.0

or, with the extras dependency to run examples/tutorials.

pip install -e git+https://github.com/uber/pyro.git@pytorch-1.0#egg=project[extras]

Install from source:

git clone https://github.com/uber/pyro
cd pyro
git checkout pytorch-1.0  # branch compatible with PyTorch 1.0 release candidate
pip install .  # pip install .[extras] for running examples/tutorials

Running Pyro from a Docker Container

Refer to the instructions here.