Skip to content

Commit

Permalink
Bump to version 0.1.0 and prepare for release (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
fritzo authored Oct 23, 2019
1 parent c2a3d2e commit d9c4c42
Show file tree
Hide file tree
Showing 20 changed files with 52 additions and 55 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pyro/contrib/examples/raw
pyro/_version.py
processed
raw
prep_seal_data.csv

# Logs
logs
Expand Down
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ install:
# Keep track of Pyro dev branch
- pip install https://github.com/pyro-ppl/pyro/archive/dev.zip

# Keep track of pyro-api master branch
- pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip

- pip install .[test]
- pip freeze

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
![unstable](https://img.shields.io/badge/status-unstable-red.svg)
[![Build Status](https://travis-ci.com/pyro-ppl/funsor.svg?branch=master)](https://travis-ci.com/pyro-ppl/funsor)
[![Latest Version](https://badge.fury.io/py/funsor.svg)](https://pypi.python.org/pypi/funsor)
[![Documentation Status](https://readthedocs.org/projects/funsor/badge)](http://funsor.readthedocs.io)

# Funsor
Expand All @@ -17,7 +17,7 @@ for a system description.
Funsor supports Python 3.6+.

```sh
pip install funsor@https://api.github.com/repos/pyro-ppl/funsor/tarball/master
pip install funsor
```

**Install from source:**
Expand Down
1 change: 0 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
contextlib2
multipledispatch
numpy>=1.7
opt_einsum>=2.3.2
Expand Down
6 changes: 3 additions & 3 deletions examples/eeg_slds.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
[1] Anderson, B., and J. Moore. "Optimal filtering. Prentice-Hall, Englewood Cliffs." New Jersey (1979).
"""
import argparse
from os.path import exists
from urllib.request import urlopen
import time
from collections import OrderedDict
from os.path import exists
from urllib.request import urlopen

import numpy as np
import torch
Expand All @@ -20,7 +20,7 @@
import funsor
import funsor.distributions as dist
import funsor.ops as ops
from funsor.pyro.convert import matrix_and_mvn_to_funsor, mvn_to_funsor, funsor_to_cat_and_mvn, funsor_to_mvn
from funsor.pyro.convert import funsor_to_cat_and_mvn, funsor_to_mvn, matrix_and_mvn_to_funsor, mvn_to_funsor


# download dataset from UCI archive
Expand Down
13 changes: 5 additions & 8 deletions examples/mixed_hmm/experiment.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import argparse
import os
import functools
import json
import os
import uuid
import functools

import torch

import pyro
import pyro.poutine as poutine
import torch

import funsor.ops as ops
from funsor.interpreter import interpretation
from funsor.optimizer import apply_optimizer
from funsor.sum_product import MarkovProduct, naive_sequential_sum_product, sum_product
from funsor.terms import lazy, to_funsor


from model import Model, Guide
from seal_data import prepare_seal, prepare_fake
from model import Guide, Model
from seal_data import prepare_fake, prepare_seal


def aic_num_parameters(model, guide=None):
Expand Down
3 changes: 1 addition & 2 deletions examples/mixed_hmm/model.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from collections import OrderedDict

import pyro
import torch
from torch.distributions import constraints

import pyro

import funsor.distributions as dist
import funsor.ops as ops
from funsor.domains import bint, reals
Expand Down
2 changes: 0 additions & 2 deletions examples/mixed_hmm/seal_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
from urllib.request import urlopen

import pandas as pd

import torch


MISSING = 1e-6


Expand Down
14 changes: 1 addition & 13 deletions funsor/adjoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,7 @@
from funsor.interpreter import interpretation
from funsor.ops import AssociativeOp
from funsor.registry import KeyedRegistry
from funsor.terms import (
Binary,
Cat,
Funsor,
Number,
Reduce,
Slice,
Subs,
Variable,
reflect,
substitute,
to_funsor,
)
from funsor.terms import Binary, Cat, Funsor, Number, Reduce, Slice, Subs, Variable, reflect, substitute, to_funsor
from funsor.torch import Tensor, materialize


Expand Down
1 change: 0 additions & 1 deletion funsor/einsum.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from funsor.sum_product import sum_product
from funsor.terms import Funsor, lazy


BACKEND_OPS = {
"torch": (ops.add, ops.mul),
"pyro.ops.einsum.torch_log": (ops.logaddexp, ops.add),
Expand Down
2 changes: 1 addition & 1 deletion funsor/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import re
import types
from collections import OrderedDict
from contextlib import contextmanager
from functools import singledispatch

import numpy
import torch
from contextlib2 import contextmanager

from funsor.domains import Domain
from funsor.ops import Op
Expand Down
2 changes: 1 addition & 1 deletion funsor/memoize.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import Hashable
from contextlib2 import contextmanager
from contextlib import contextmanager

import funsor.interpreter as interpreter

Expand Down
3 changes: 1 addition & 2 deletions funsor/montecarlo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from collections import OrderedDict

from contextlib2 import contextmanager
from contextlib import contextmanager

from funsor.integrate import Integrate
from funsor.interpreter import dispatched_interpretation, interpretation
Expand Down
2 changes: 1 addition & 1 deletion funsor/torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import itertools
import warnings
from collections import OrderedDict
from contextlib import contextmanager
from functools import reduce

import opt_einsum
import torch
from contextlib2 import contextmanager
from multipledispatch import dispatch
from multipledispatch.variadic import Variadic

Expand Down
33 changes: 27 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
import sys

from setuptools import find_packages, setup

# READ README.md for long description on PyPi.
# This requires uploading via twine, e.g.:
# $ python setup.py sdist bdist_wheel
# $ twine upload --repository-url https://test.pypi.org/legacy/ dist/* # test version
# $ twine upload dist/*
try:
long_description = open('README.md', encoding='utf-8').read()
except Exception as e:
sys.stderr.write(f'Failed to convert README.md to rst:\n {e}\n')
sys.stderr.flush()
long_description = ''

# Remove badges since they will always be obsolete.
# This assumes the first 4 lines contain badge info.
long_description = '\n'.join(line for line in long_description.split('\n')[4:])

setup(
name='funsor',
version='0.0.0',
description='Functional analysis + tensors + symbolic algebra',
version='0.1.0',
description='A tensor-like library for functions and distributions',
packages=find_packages(include=['funsor', 'funsor.*']),
url='https://github.com/pyro-ppl/funsor',
project_urls={
"Documentation": "https://funsor.pyro.ai",
},
author='Uber AI Labs',
author_email='[email protected]',
install_requires=[
'contextlib2',
'multipledispatch',
'numpy>=1.7',
'opt_einsum>=2.3.2',
'pyro-ppl>=0.3',
'pyro-ppl>=0.5',
'torch>=1.3.0',
],
extras_require={
Expand All @@ -23,7 +43,7 @@
'pytest>=4.1',
'pytest-xdist==1.27.0',
'torchvision==0.2.1',
'pyro-api@https://api.github.com/repos/pyro-ppl/pyro-api/tarball/master',
'pyro-api>=0.1',
],
'dev': [
'flake8',
Expand All @@ -36,7 +56,8 @@
'torchvision==0.2.1',
],
},
tests_require=['flake8', 'pandas', 'pytest>=4.1'],
long_description=long_description,
long_description_content_type='text/markdown',
keywords='probabilistic machine learning bayesian statistics pytorch',
classifiers=[
'Intended Audience :: Developers',
Expand Down
10 changes: 2 additions & 8 deletions test/test_adjoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@
from funsor.einsum import BACKEND_ADJOINT_OPS, einsum, naive_einsum, naive_plated_einsum
from funsor.interpreter import interpretation
from funsor.optimizer import apply_optimizer
from funsor.sum_product import (
MarkovProduct,
naive_sequential_sum_product,
sequential_sum_product,
sum_product
)
from funsor.sum_product import MarkovProduct, naive_sequential_sum_product, sequential_sum_product, sum_product
from funsor.terms import Variable, reflect
from funsor.testing import (
assert_close,
Expand All @@ -26,10 +21,9 @@
make_plated_hmm_einsum,
random_gaussian,
random_tensor,
xfail_param,
xfail_param
)


EINSUM_EXAMPLES = [
"a->",
"ab->",
Expand Down
2 changes: 1 addition & 1 deletion test/test_joint.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import funsor.ops as ops
from funsor.cnf import Contraction
from funsor.delta import Delta, Delta
from funsor.delta import Delta
from funsor.domains import bint, reals
from funsor.gaussian import Gaussian
from funsor.integrate import Integrate
Expand Down
1 change: 0 additions & 1 deletion test/test_memoize.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from funsor.terms import reflect
from funsor.testing import make_einsum_example, xfail_param


EINSUM_EXAMPLES = [
("a,b->", ''),
("ab,a->", ''),
Expand Down
2 changes: 1 addition & 1 deletion test/test_optimizer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from collections import OrderedDict

from pyro.ops.contract import einsum as pyro_einsum
import pytest
import torch
from pyro.ops.contract import einsum as pyro_einsum

import funsor
from funsor.distributions import Categorical
Expand Down
2 changes: 1 addition & 1 deletion test/test_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from funsor.interpreter import interpretation
from funsor.terms import Cat, Lambda, Number, Slice, Stack, Variable, lazy
from funsor.testing import assert_close, assert_equiv, check_funsor, random_tensor
from funsor.torch import REDUCE_OP_TO_TORCH, Einsum, Tensor, arange, align_tensors, torch_stack, torch_tensordot
from funsor.torch import REDUCE_OP_TO_TORCH, Einsum, Tensor, align_tensors, arange, torch_stack, torch_tensordot


@pytest.mark.parametrize('output_shape', [(), (2,), (3, 2)], ids=str)
Expand Down

0 comments on commit d9c4c42

Please sign in to comment.