From da5286cd2b23e080b383594d6069e4487ef233de Mon Sep 17 00:00:00 2001 From: happysalada Date: Mon, 17 Jul 2023 10:28:52 +0900 Subject: [PATCH] python310Packages.tf2onnx: init at 1.14.0 --- .../python-modules/tf2onnx/default.nix | 86 +++++++++++++++++++ .../python-modules/transformers/default.nix | 5 +- pkgs/top-level/python-packages.nix | 2 + 3 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/python-modules/tf2onnx/default.nix diff --git a/pkgs/development/python-modules/tf2onnx/default.nix b/pkgs/development/python-modules/tf2onnx/default.nix new file mode 100644 index 000000000000..b1fe7abfae25 --- /dev/null +++ b/pkgs/development/python-modules/tf2onnx/default.nix @@ -0,0 +1,86 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pythonRelaxDepsHook +, pytest-runner +# runtime dependencies +, numpy +, onnx +, requests +, six +, flatbuffers +, protobuf +, tensorflow +# check dependencies +, pytestCheckHook +, graphviz +, parameterized +, pytest-cov +, pyyaml +, timeout-decorator +, onnxruntime +, keras +}: + +buildPythonPackage rec { + pname = "tf2onnx"; + version = "1.14.0"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "onnx"; + repo = "tensorflow-onnx"; + rev = "v${version}"; + hash = "sha256-JpXwf+GLjn0krsb5KnEhVuemWa0V2+wF10neDsdtOfI="; + }; + + nativeBuildInputs = [ + pythonRelaxDepsHook + pytest-runner + ]; + + pythonRelaxDeps = [ + "flatbuffers" + ]; + + propagatedBuildInputs = [ + numpy + onnx + requests + six + flatbuffers + protobuf + tensorflow + onnxruntime + ]; + + pythonImportsCheck = [ "tf2onnx" ]; + + nativeCheckInputs = [ + pytestCheckHook + graphviz + parameterized + pytest-cov + pyyaml + timeout-decorator + keras + ]; + + # TODO investigate the failures + disabledTestPaths = [ + "tests/test_backend.py" + "tests/test_einsum_helper.py" + "tests/test_einsum_optimizers.py" + ]; + + disabledTests = [ + "test_profile_conversion_time" + ]; + + meta = with lib; { + description = "Convert TensorFlow, Keras, Tensorflow.js and Tflite models to ONNX"; + homepage = "https://github.com/onnx/tensorflow-onnx"; + license = licenses.asl20; + maintainers = with maintainers; [ happysalada ]; + }; +} diff --git a/pkgs/development/python-modules/transformers/default.nix b/pkgs/development/python-modules/transformers/default.nix index 8855637016c6..dbeb2a01ca09 100644 --- a/pkgs/development/python-modules/transformers/default.nix +++ b/pkgs/development/python-modules/transformers/default.nix @@ -18,6 +18,7 @@ , scikit-learn , tensorflow , onnxconverter-common +, tf2onnx , torch , accelerate , faiss @@ -99,7 +100,7 @@ buildPythonPackage rec { tf = [ tensorflow onnxconverter-common - # tf2onnx + tf2onnx # tensorflow-text # keras-nlp ]; @@ -119,7 +120,7 @@ buildPythonPackage rec { ]; onnx = [ onnxconverter-common - # tf2onnx + tf2onnx onnxruntime ]; modelcreation = [ diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 566739c81717..d63c3297832e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -12387,6 +12387,8 @@ self: super: with self; { textx = callPackage ../development/python-modules/textx { }; + tf2onnx = callPackage ../development/python-modules/tf2onnx { }; + tflearn = callPackage ../development/python-modules/tflearn { }; tftpy = callPackage ../development/python-modules/tftpy { };