2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
2024-07-27 06:49:29 +00:00
|
|
|
pythonOlder,
|
|
|
|
fetchFromGitHub,
|
|
|
|
|
|
|
|
# build-system
|
2024-06-05 15:53:02 +00:00
|
|
|
flit-core,
|
2024-07-27 06:49:29 +00:00
|
|
|
|
|
|
|
# dependencies
|
|
|
|
absl-py,
|
2024-06-05 15:53:02 +00:00
|
|
|
chex,
|
2024-07-27 06:49:29 +00:00
|
|
|
jax,
|
2024-06-05 15:53:02 +00:00
|
|
|
jaxlib,
|
|
|
|
numpy,
|
2024-07-27 06:49:29 +00:00
|
|
|
etils,
|
|
|
|
|
|
|
|
# checks
|
2024-06-05 15:53:02 +00:00
|
|
|
callPackage,
|
2022-01-07 04:07:37 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "optax";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.2.3";
|
2024-04-21 15:54:59 +00:00
|
|
|
pyproject = true;
|
2022-11-27 09:42:12 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
disabled = pythonOlder "3.9";
|
2022-01-07 04:07:37 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "deepmind";
|
2024-04-21 15:54:59 +00:00
|
|
|
repo = "optax";
|
2022-08-12 12:06:08 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-D1qKei3IjDP9fC62hf6fNtvHlnn09O/dKuzTBdLwW64=";
|
2022-01-07 04:07:37 +00:00
|
|
|
};
|
|
|
|
|
2022-07-18 16:21:45 +00:00
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"testsout"
|
|
|
|
];
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
build-system = [ flit-core ];
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
dependencies = [
|
2022-01-07 04:07:37 +00:00
|
|
|
absl-py
|
|
|
|
chex
|
2024-07-27 06:49:29 +00:00
|
|
|
etils
|
|
|
|
jax
|
|
|
|
jaxlib
|
2022-01-07 04:07:37 +00:00
|
|
|
numpy
|
2024-07-27 06:49:29 +00:00
|
|
|
] ++ etils.optional-dependencies.epy;
|
2022-01-07 04:07:37 +00:00
|
|
|
|
2022-07-18 16:21:45 +00:00
|
|
|
postInstall = ''
|
|
|
|
mkdir $testsout
|
|
|
|
cp -R examples $testsout/examples
|
|
|
|
'';
|
2022-01-07 04:07:37 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "optax" ];
|
2022-01-07 04:07:37 +00:00
|
|
|
|
2022-07-18 16:21:45 +00:00
|
|
|
# check in passthru.tests.pytest to escape infinite recursion with flax
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
passthru.tests = {
|
|
|
|
pytest = callPackage ./tests.nix { };
|
|
|
|
};
|
2022-01-07 04:07:37 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2022-11-27 09:42:12 +00:00
|
|
|
description = "Gradient processing and optimization library for JAX";
|
2022-01-07 04:07:37 +00:00
|
|
|
homepage = "https://github.com/deepmind/optax";
|
2022-11-27 09:42:12 +00:00
|
|
|
changelog = "https://github.com/deepmind/optax/releases/tag/v${version}";
|
2022-01-07 04:07:37 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ ndl ];
|
|
|
|
};
|
|
|
|
}
|