2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pytest-runner,
|
|
|
|
# runtime dependencies
|
|
|
|
numpy,
|
|
|
|
onnx,
|
|
|
|
requests,
|
|
|
|
six,
|
|
|
|
flatbuffers,
|
|
|
|
protobuf,
|
|
|
|
tensorflow,
|
|
|
|
# check dependencies
|
|
|
|
pytestCheckHook,
|
|
|
|
graphviz,
|
|
|
|
parameterized,
|
|
|
|
pytest-cov,
|
|
|
|
pyyaml,
|
|
|
|
timeout-decorator,
|
|
|
|
onnxruntime,
|
|
|
|
keras,
|
2023-08-04 22:07:22 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "tf2onnx";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "1.16.1";
|
2023-08-04 22:07:22 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "onnx";
|
|
|
|
repo = "tensorflow-onnx";
|
2023-11-16 04:20:00 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-qtRzckw/KHWm3gjFwF+cPuBhGbfktjhYIwImwHn2CFk=";
|
2023-08-04 22:07:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pytest-runner
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonRelaxDeps = [ "flatbuffers" ];
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
disabledTests = [ "test_profile_conversion_time" ];
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
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 ];
|
2024-06-05 15:53:02 +00:00
|
|
|
# Duplicated `protobuf` in the derivation:
|
|
|
|
# - version 4.24.4 (from onnx), the default version of protobuf in nixpkgs
|
|
|
|
# - version 4.21.12 (from tensorflow), pinned as such because tensorflow is outdated and does
|
|
|
|
# not support more recent versions of protobuf
|
|
|
|
broken = true;
|
2023-08-04 22:07:22 +00:00
|
|
|
};
|
|
|
|
}
|