summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/dm-sonnet/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/dm-sonnet/default.nix')
-rw-r--r--pkgs/development/python-modules/dm-sonnet/default.nix63
1 files changed, 43 insertions, 20 deletions
diff --git a/pkgs/development/python-modules/dm-sonnet/default.nix b/pkgs/development/python-modules/dm-sonnet/default.nix
index 06b01a447843..62cae899b80e 100644
--- a/pkgs/development/python-modules/dm-sonnet/default.nix
+++ b/pkgs/development/python-modules/dm-sonnet/default.nix
@@ -1,43 +1,45 @@
{
lib,
buildPythonPackage,
- click,
+ fetchFromGitHub,
+
+ # build-system
+ setuptools,
+
+ # dependencies
dm-tree,
- docutils,
etils,
- fetchFromGitHub,
- fetchpatch,
numpy,
- pythonOlder,
tabulate,
+ wrapt,
+
+ # tests
+ click,
+ docutils,
+ keras,
+ pytestCheckHook,
tensorflow,
tensorflow-datasets,
- wrapt,
+ tf-keras,
}:
buildPythonPackage rec {
pname = "dm-sonnet";
version = "2.0.2";
- format = "setuptools";
-
- disabled = pythonOlder "3.6";
+ pyproject = true;
src = fetchFromGitHub {
owner = "deepmind";
repo = "sonnet";
- rev = "refs/tags/v${version}";
+ tag = "v${version}";
hash = "sha256-WkloUbqSyPG3cbLG8ktsjdluACkCbUZ7t6rYWst8rs8=";
};
- patches = [
- (fetchpatch {
- name = "replace-np-bool-with-np-bool_.patch";
- url = "https://github.com/deepmind/sonnet/commit/df5d099d4557a9a81a0eb969e5a81ed917bcd612.patch";
- hash = "sha256-s7abl83osD4wa0ZhqgDyjqQ3gagwGYCdQifwFqhNp34=";
- })
+ build-system = [
+ setuptools
];
- propagatedBuildInputs = [
+ dependencies = [
dm-tree
etils
numpy
@@ -52,16 +54,37 @@ buildPythonPackage rec {
nativeCheckInputs = [
click
docutils
+ keras
+ pytestCheckHook
tensorflow
tensorflow-datasets
+ tf-keras
+ ];
+
+ # ImportError: `keras.optimizers.legacy` is not supported in Keras 3
+ preCheck = ''
+ export TF_USE_LEGACY_KERAS=True
+ '';
+
+ disabledTests = [
+ # AssertionError: 2 != 0 : 2 doctests failed
+ "test_doctest_sonnet.functional"
+
+ # AssertionError: Not equal to tolerance
+ "testComputationAgainstNumPy1"
+
+ # tensorflow.python.framework.errors_impl.InvalidArgumentError: cannot compute MatMul as input #1(zero-based) was expected to be a float tensor but is a half tensor [Op:MatMul]
+ "testComputationAgainstNumPy0"
+ "testComputationAgainstNumPy1"
];
pythonImportsCheck = [ "sonnet" ];
- meta = with lib; {
+ meta = {
description = "Library for building neural networks in TensorFlow";
homepage = "https://github.com/deepmind/sonnet";
- license = licenses.asl20;
- maintainers = with maintainers; [ onny ];
+ changelog = "https://github.com/google-deepmind/sonnet/releases/tag/v${version}";
+ license = lib.licenses.asl20;
+ maintainers = with lib.maintainers; [ onny ];
};
}