git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #52936 from teh/pyro

Pyro

commita02b6bc318d16bfcbd31f4b25ec9d63b32f7e5f5 authorSilvan Mosberger <infinisil@icloud.com> dateMon 31 Dec 2018, 03:47 (8 years ago) parentf43c75eda01f2a
3 files changed+73
pkgs/development/python-modules/opt-einsum/default.nix+31 pkgs/development/python-modules/pyro-ppl/default.nix+38 pkgs/top-level/python-packages.nix+4
pkgs/development/python-modules/opt-einsum/default.nixnew file+31
@@ -0,0 +1,31 @@
1+{ buildPythonPackage, fetchPypi, lib, numpy, pytest, pytestpep8, pytestcov }:
2+buildPythonPackage rec {
3+ version = "2.3.2";
4+ pname = "opt_einsum";
5+
6+ src = fetchPypi {
7+ inherit version pname;
8+ sha256 = "0ny3v8x83mzpwmqjdzqhzy2pzwyy4wx01r1h9i29xw3yvas69m6k";
9+ };
10+
11+ checkInputs = [
12+ pytest
13+ pytestpep8
14+ pytestcov
15+ ];
16+
17+ checkPhase = ''
18+ pytest
19+ '';
20+
21+ propagatedBuildInputs = [
22+ numpy
23+ ];
24+
25+ meta = {
26+ description = "Optimizing NumPy's einsum function with order optimization and GPU support.";
27+ homepage = http://optimized-einsum.readthedocs.io;
28+ license = lib.licenses.mit;
29+ maintainers = with lib.maintainers; [ teh ];
30+ };
31+}
pkgs/development/python-modules/pyro-ppl/default.nixnew file+38
@@ -0,0 +1,38 @@
1+{ buildPythonPackage, fetchPypi, lib, pytorch, contextlib2
2+, graphviz, networkx, six, opt-einsum, tqdm }:
3+buildPythonPackage rec {
4+ version = "0.3.0";
5+ pname = "pyro-ppl";
6+
7+ src = fetchPypi {
8+ inherit version pname;
9+ sha256 = "0shsnc5bia9k1fzmqnwwbm1x5qvac3zrq4lvyhg27rjgpcamvb9l";
10+ };
11+
12+ propagatedBuildInputs = [
13+ pytorch
14+ contextlib2
15+ # TODO(tom): graphviz pulls in a lot of dependencies - make
16+ # optional when some time to figure out how.
17+ graphviz
18+ networkx
19+ six
20+ opt-einsum
21+ tqdm
22+ ];
23+
24+ # pyro not shipping tests do simple smoke test instead
25+ checkPhase = ''
26+ python -c "import pyro"
27+ python -c "import pyro.distributions"
28+ python -c "import pyro.infer"
29+ python -c "import pyro.optim"
30+ '';
31+
32+ meta = {
33+ description = "A Python library for probabilistic modeling and inference";
34+ homepage = http://pyro.ai;
35+ license = lib.licenses.mit;
36+ maintainers = with lib.maintainers; [ teh ];
37+ };
38+}
pkgs/top-level/python-packages.nix+4
@@ -2423,6 +2423,10 @@ in {
24232423 cudaSupport = pkgs.config.cudaSupport or false;
24242424 };
24252425
2426+ pyro-ppl = callPackage ../development/python-modules/pyro-ppl {};
2427+
2428+ opt-einsum = callPackage ../development/python-modules/opt-einsum {};
2429+
24262430 pytorchWithCuda = self.pytorch.override {
24272431 cudaSupport = true;
24282432 };