diff --git a/pkgs/development/python-modules/ax/default.nix b/pkgs/development/python-modules/ax/default.nix new file mode 100644 index 000000000000..5f87602064bf --- /dev/null +++ b/pkgs/development/python-modules/ax/default.nix @@ -0,0 +1,70 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, botorch +, ipywidgets +, jinja2 +, pandas +, plotly +, setuptools-scm +, typeguard +, hypothesis +, mercurial +, pyfakefs +, pytestCheckHook +, yappi +}: + +buildPythonPackage rec { + pname = "ax"; + version = "0.3.2"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "facebook"; + repo = pname; + rev = version; + hash = "sha256-1KLLjeUktXvIDOlTQzMmpbL/On8PTxZQ44Qi4BT3nPk="; + }; + + propagatedBuildInputs = [ + botorch + ipywidgets + jinja2 + pandas + plotly + setuptools-scm + typeguard + ]; + + SETUPTOOLS_SCM_PRETEND_VERSION = version; + + checkInputs = [ + hypothesis + mercurial + pyfakefs + pytestCheckHook + yappi + ]; + pytestFlagsArray = [ + "--ignore=ax/benchmark" + "--ignore=ax/runners/tests/test_torchx.py" + # requires pyre_extensions + "--ignore=ax/telemetry/tests" + "--ignore=ax/core/tests/test_utils.py" + "--ignore=ax/early_stopping/tests/test_strategies.py" + # broken with sqlalchemy 2 + "--ignore=ax/service/tests/test_ax_client.py" + "--ignore=ax/service/tests/test_scheduler.py" + "--ignore=ax/service/tests/test_with_db_settings_base.py" + "--ignore=ax/storage" + ]; + pythonImportsCheck = [ "ax" ]; + + meta = with lib; { + description = "Ax is an accessible, general-purpose platform for understanding, managing, deploying, and automating adaptive experiments"; + homepage = "https://ax.dev/"; + license = licenses.mit; + maintainers = with maintainers; [ veprbl ]; + }; +} diff --git a/pkgs/development/python-modules/botorch/default.nix b/pkgs/development/python-modules/botorch/default.nix new file mode 100644 index 000000000000..ac31c7fdd9a1 --- /dev/null +++ b/pkgs/development/python-modules/botorch/default.nix @@ -0,0 +1,51 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, gpytorch +, linear_operator +, multipledispatch +, pyro-ppl +, setuptools-scm +, torch +, scipy +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "botorch"; + version = "0.8.5"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "pytorch"; + repo = pname; + rev = "v${version}"; + hash = "sha256-VcNHgfk8OfLJseQxHksycWuCPCudCtOdcRV0XnxHSfU="; + }; + + buildInputs = [ + setuptools-scm + ]; + propagatedBuildInputs = [ + gpytorch + linear_operator + multipledispatch + pyro-ppl + scipy + torch + ]; + + SETUPTOOLS_SCM_PRETEND_VERSION = version; + + checkInputs = [ + pytestCheckHook + ]; + pythonImportsCheck = [ "botorch" ]; + + meta = with lib; { + description = "Bayesian Optimization in PyTorch"; + homepage = "https://botorch.org"; + license = licenses.mit; + maintainers = with maintainers; [ veprbl ]; + }; +} diff --git a/pkgs/development/python-modules/gpytorch/default.nix b/pkgs/development/python-modules/gpytorch/default.nix new file mode 100644 index 000000000000..f914bc326ba9 --- /dev/null +++ b/pkgs/development/python-modules/gpytorch/default.nix @@ -0,0 +1,51 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, linear_operator +, scikit-learn +, torch +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "gpytorch"; + version = "1.10"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "cornellius-gp"; + repo = pname; + rev = "v${version}"; + hash = "sha256-KY3ItkVjBfIYMkZAmD56EBGR9YN/MRN7b2K3zrK6Qmk="; + }; + + postPatch = '' + substituteInPlace setup.py \ + --replace 'find_version("gpytorch", "version.py")' \"$version\" + ''; + + propagatedBuildInputs = [ + linear_operator + scikit-learn + torch + ]; + + checkInputs = [ + pytestCheckHook + ]; + pythonImportsCheck = [ "gpytorch" ]; + disabledTests = [ + # AssertionError on number of warnings emitted + "test_deprecated_methods" + # flaky numerical tests + "test_classification_error" + "test_matmul_matrix_broadcast" + ]; + + meta = with lib; { + description = "A highly efficient and modular implementation of Gaussian Processes, with GPU acceleration"; + homepage = "https://gpytorch.ai"; + license = licenses.mit; + maintainers = with maintainers; [ veprbl ]; + }; +} diff --git a/pkgs/development/python-modules/linear_operator/default.nix b/pkgs/development/python-modules/linear_operator/default.nix new file mode 100644 index 000000000000..48fb004c14c4 --- /dev/null +++ b/pkgs/development/python-modules/linear_operator/default.nix @@ -0,0 +1,46 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, scipy +, torch +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "linear_operator"; + version = "0.4.0"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "cornellius-gp"; + repo = pname; + rev = "v${version}"; + hash = "sha256-0f3F3k3xJACbx42jtwsAmjZwPAOfLywZs8VOrwWicc4="; + }; + + postPatch = '' + substituteInPlace setup.py \ + --replace 'find_version("linear_operator", "version.py")' \"$version\" + ''; + + propagatedBuildInputs = [ + scipy + torch + ]; + + checkInputs = [ + pytestCheckHook + ]; + pythonImportsCheck = [ "linear_operator" ]; + disabledTests = [ + # flaky numerical tests + "test_svd" + ]; + + meta = with lib; { + description = "A LinearOperator implementation to wrap the numerical nuts and bolts of GPyTorch"; + homepage = "https://github.com/cornellius-gp/linear_operator/"; + license = licenses.mit; + maintainers = with maintainers; [ veprbl ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index bc5537343022..26b7aee601cb 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -881,6 +881,8 @@ self: super: with self; { awswrangler = callPackage ../development/python-modules/awswrangler { }; + ax = callPackage ../development/python-modules/ax { }; + axis = callPackage ../development/python-modules/axis { }; azure-appconfiguration = callPackage ../development/python-modules/azure-appconfiguration { }; @@ -1439,6 +1441,8 @@ self: super: with self; { botocore = callPackage ../development/python-modules/botocore { }; + botorch = callPackage ../development/python-modules/botorch { }; + bottle = callPackage ../development/python-modules/bottle { }; bottleneck = callPackage ../development/python-modules/bottleneck { }; @@ -4235,6 +4239,8 @@ self: super: with self; { gpy = callPackage ../development/python-modules/gpy { }; + gpytorch = callPackage ../development/python-modules/gpytorch { }; + gpt-2-simple = callPackage ../development/python-modules/gpt-2-simple { }; gpyopt = callPackage ../development/python-modules/gpyopt { }; @@ -5718,6 +5724,8 @@ self: super: with self; { limnoria = callPackage ../development/python-modules/limnoria { }; + linear_operator = callPackage ../development/python-modules/linear_operator { }; + linecache2 = callPackage ../development/python-modules/linecache2 { }; lineedit = callPackage ../development/python-modules/lineedit { };