about summary refs log tree commit diff
path: root/pkgs/development/python-modules/tf2onnx/default.nix
blob: 7c1926a11cbd70e1ed70c835c6db3fed1c4e781e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{
  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.16.1";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "onnx";
    repo = "tensorflow-onnx";
    rev = "refs/tags/v${version}";
    hash = "sha256-qtRzckw/KHWm3gjFwF+cPuBhGbfktjhYIwImwHn2CFk=";
  };

  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 ];
    # 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;
  };
}