Skip to content

Commit f5b3b50

Browse files
committed
merge master
2 parents c2f96ef + de22e71 commit f5b3b50

File tree

206 files changed

+31779
-8571
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+31779
-8571
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: [3.6]
17+
python-version: [3.7]
1818

1919
steps:
2020
- uses: actions/checkout@v2
@@ -24,7 +24,7 @@ jobs:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install dependencies
2626
run: |
27-
sudo apt install -y pandoc
27+
sudo apt install -y pandoc gsfonts
2828
python -m pip install --upgrade pip
2929
pip install https://github.com/pyro-ppl/funsor/archive/master.zip
3030
pip install jaxlib
@@ -44,13 +44,13 @@ jobs:
4444
python -m doctest -v README.md
4545
4646
47-
test:
47+
test-modeling:
4848

4949
runs-on: ubuntu-latest
5050
needs: lint
5151
strategy:
5252
matrix:
53-
python-version: [3.6]
53+
python-version: [3.7]
5454

5555
steps:
5656
- uses: actions/checkout@v2
@@ -60,6 +60,7 @@ jobs:
6060
python-version: ${{ matrix.python-version }}
6161
- name: Install dependencies
6262
run: |
63+
sudo apt install -y graphviz
6364
python -m pip install --upgrade pip
6465
# Keep track of pyro-api master branch
6566
pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip
@@ -70,14 +71,45 @@ jobs:
7071
pip freeze
7172
- name: Test with pytest
7273
run: |
73-
pytest -vs -k "not test_example" --durations=100
74+
CI=1 pytest -vs -k "not test_example" --durations=100 --ignore=test/infer/
75+
76+
77+
test-inference:
78+
79+
runs-on: ubuntu-latest
80+
needs: lint
81+
strategy:
82+
matrix:
83+
python-version: [3.7]
84+
85+
steps:
86+
- uses: actions/checkout@v2
87+
- name: Set up Python ${{ matrix.python-version }}
88+
uses: actions/setup-python@v2
89+
with:
90+
python-version: ${{ matrix.python-version }}
91+
- name: Install dependencies
92+
run: |
93+
python -m pip install --upgrade pip
94+
# Keep track of pyro-api master branch
95+
pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip
96+
pip install https://github.com/pyro-ppl/funsor/archive/master.zip
97+
pip install jaxlib
98+
pip install jax
99+
pip install .[dev,test]
100+
pip freeze
101+
- name: Test with pytest
102+
run: |
103+
pytest -vs --durations=20 test/infer/test_mcmc.py
104+
pytest -vs --durations=20 test/infer --ignore=test/infer/test_mcmc.py
74105
- name: Test x64
75106
run: |
76-
JAX_ENABLE_X64=1 pytest -vs test/test_mcmc.py -k x64
107+
JAX_ENABLE_X64=1 pytest -vs test/infer/test_mcmc.py -k x64
77108
- name: Test chains
78109
run: |
79-
XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/test_mcmc.py -k "chain or pmap or vmap"
110+
XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/infer/test_mcmc.py -k "chain or pmap or vmap"
80111
XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/contrib/test_tfp.py -k "chain"
112+
XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/infer/test_hmc_gibbs.py -k "chain"
81113
82114
83115
examples:
@@ -86,7 +118,7 @@ jobs:
86118
needs: lint
87119
strategy:
88120
matrix:
89-
python-version: [3.6]
121+
python-version: [3.7]
90122

91123
steps:
92124
- uses: actions/checkout@v2
@@ -103,8 +135,5 @@ jobs:
103135
pip install .[dev,examples,test]
104136
pip freeze
105137
- name: Test with pytest
106-
run: |
107-
pytest -vs -k test_example
108-
- name: Test chains
109138
run: |
110139
XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs -k test_example

CONTRIBUTING.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Development
2+
3+
Please follow our established coding style including variable names, module imports, and function definitions.
4+
The NumPyro codebase follows the [PEP8 style guide](https://www.python.org/dev/peps/pep-0008/)
5+
(which you can check with `make lint`) and follows
6+
[`isort`](https://github.com/timothycrosley/isort) import order (which you can enforce with `make format`).
7+
8+
# Setup
9+
10+
To set up local development environment, install NumPyro from source:
11+
12+
```sh
13+
git clone https://github.com/pyro-ppl/numpyro.git
14+
# install jax/jaxlib first for CUDA support
15+
pip install -e .[dev,test] # contains additional dependencies for NumPyro development
16+
```
17+
18+
# Testing
19+
20+
Before submitting a pull request, please autoformat code and ensure that unit tests pass locally
21+
```sh
22+
make lint # linting
23+
make format # runs black and isort
24+
make test # linting and unit tests
25+
make doctest # test module's docstrings
26+
```
27+
28+
To run all tests locally in parallel, use the `pytest-xdist` package
29+
```sh
30+
pip install pytest-xdist
31+
pytest -vs -n auto
32+
```
33+
34+
To run a single test from the command line
35+
```sh
36+
pytest -vs {path_to_test}::{test_name}
37+
# or in cuda mode and double precision
38+
JAX_PLATFORM_NAME=gpu JAX_ENABLE_X64=1 pytest -vs {path_to_test}::{test_name}
39+
```
40+
41+
# Profiling
42+
43+
TensorBoard can be used to profile NumPyro following the instructions following [JAX documentation](https://jax.readthedocs.io/en/latest/profiling.html).
44+
45+
# Submitting
46+
47+
For relevant design questions to consider, see past [design documents](https://github.com/pyro-ppl/pyro/wiki/Design-Docs).
48+
49+
For larger changes, please open an issue for discussion before submitting a pull request.
50+
51+
In your PR, please include:
52+
- Changes made
53+
- Links to related issues/PRs
54+
- Tests
55+
- Dependencies
56+
57+
If you add new files, please run `make license` to automatically add copyright headers.
58+
59+
For speculative changes meant for early-stage review, include `[WIP]` in the PR's title.
60+
(One of the maintainers will add the `WIP` tag.)

Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@ all: test
22

33
lint: FORCE
44
flake8
5+
black --check .
6+
isort --check .
7+
python scripts/update_headers.py --check
58

6-
format: FORCE
7-
isort -rc .
9+
license: FORCE
10+
python scripts/update_headers.py
11+
12+
format: license FORCE
13+
black .
14+
isort .
15+
16+
install: FORCE
17+
pip install -e .[dev,doc,test,examples]
818

919
doctest: FORCE
10-
$(MAKE) -C docs doctest
20+
JAX_PLATFORM_NAME=cpu $(MAKE) -C docs doctest
1121

1222
test: lint FORCE
1323
pytest -v test

0 commit comments

Comments
 (0)