2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
cloudpickle,
|
|
|
|
deepdish,
|
|
|
|
deepmerge,
|
|
|
|
dm-haiku,
|
|
|
|
fetchFromGitHub,
|
|
|
|
fetchpatch,
|
|
|
|
jaxlib,
|
|
|
|
poetry-core,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
pyyaml,
|
|
|
|
sh,
|
|
|
|
tables,
|
|
|
|
tabulate,
|
|
|
|
tensorboardx,
|
|
|
|
tensorflow,
|
|
|
|
toolz,
|
|
|
|
torch,
|
|
|
|
treex,
|
|
|
|
typing-extensions,
|
2022-01-13 20:06:32 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "elegy";
|
2022-04-03 18:54:34 +00:00
|
|
|
version = "0.8.6";
|
2022-01-13 20:06:32 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "poets-ai";
|
|
|
|
repo = pname;
|
2022-12-17 10:02:37 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2022-04-03 18:54:34 +00:00
|
|
|
hash = "sha256-FZmLriYhsX+zyQKCtCjbOy6MH+AvjzHRNUyaDSXGlLI=";
|
2022-01-13 20:06:32 +00:00
|
|
|
};
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "use-poetry-core.patch";
|
|
|
|
url = "https://github.com/poets-ai/elegy/commit/0ed472882f470ed9eb7a63b8a537ffabe7e19aa7.patch";
|
|
|
|
hash = "sha256-nO/imHo7tEsiZh+64CF/M4eXQ1so3IunVhv8CvYP1ks=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
# The cloudpickle constraint is too strict. wandb is marked as an optional
|
|
|
|
# dependency but `buildPythonPackage` doesn't seem to respect that setting.
|
2022-10-21 18:38:19 +00:00
|
|
|
# Python constraint: https://github.com/poets-ai/elegy/issues/244
|
2022-04-03 18:54:34 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
2022-10-21 18:38:19 +00:00
|
|
|
--replace 'python = ">=3.7,<3.10"' 'python = ">=3.7"' \
|
2022-04-03 18:54:34 +00:00
|
|
|
--replace 'cloudpickle = "^1.5.0"' 'cloudpickle = "*"' \
|
|
|
|
--replace 'wandb = { version = "^0.12.10", optional = true }' ""
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ poetry-core ];
|
2022-01-13 20:06:32 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs = [ jaxlib ];
|
2022-02-10 20:34:41 +00:00
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
cloudpickle
|
|
|
|
deepdish
|
|
|
|
deepmerge
|
|
|
|
dm-haiku
|
|
|
|
pyyaml
|
|
|
|
tables
|
|
|
|
tabulate
|
|
|
|
tensorboardx
|
|
|
|
toolz
|
|
|
|
treex
|
|
|
|
typing-extensions
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "elegy" ];
|
2022-01-13 20:06:32 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-01-13 20:06:32 +00:00
|
|
|
pytestCheckHook
|
|
|
|
sh
|
|
|
|
tensorflow
|
2022-12-17 10:02:37 +00:00
|
|
|
torch
|
2022-01-13 20:06:32 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# Fails with `Could not find compiler for platform Host: NOT_FOUND: could not find registered compiler for platform Host -- check target linkage`.
|
|
|
|
# Runs fine in docker with Ubuntu 22.04. I suspect the issue is the sandboxing in `nixpkgs` but not sure.
|
|
|
|
"test_saved_model_poly"
|
2022-10-21 18:38:19 +00:00
|
|
|
# AttributeError: module 'jax' has no attribute 'tree_multimap'
|
|
|
|
"DataLoaderTestCase"
|
2022-01-13 20:06:32 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Neural Networks framework based on Jax inspired by Keras and Haiku";
|
|
|
|
homepage = "https://github.com/poets-ai/elegy";
|
2022-12-17 10:02:37 +00:00
|
|
|
changelog = "https://github.com/poets-ai/elegy/releases/tag/${version}";
|
2022-01-13 20:06:32 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ ndl ];
|
|
|
|
};
|
|
|
|
}
|