summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/amd-quark/default.nix
blob: c8ee39f170e3c2157b3d8cf93c5276fe1e8c2f97 (plain)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,
  mypy-protobuf,

  # dependencies
  evaluate,
  joblib,
  ninja,
  numpy,
  onnx,
  onnxscript,
  onnxslim,
  pandas,
  plotly,
  protobuf,
  pydantic,
  rich,
  scipy,
  sentencepiece,
  tqdm,
  zstandard,
}:
buildPythonPackage (finalAttrs: {
  pname = "amd-quark";
  version = "0.11.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "amd";
    repo = "Quark";
    tag = "v${finalAttrs.version}";
    hash = "sha256-x0y3NFbXAF1SnlzQSkWKEWiz0qRPYHWvQ6oTizKpyQw=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail '"protobuf-protoc-bin==31.1",' ""
    substituteInPlace setup.py \
      --replace-fail 'subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])' 'b"nix"'
  '';

  env.QUARK_RELEASE = "1";

  build-system = [
    setuptools
    mypy-protobuf
  ];

  dependencies = [
    evaluate
    joblib
    ninja
    numpy
    onnx
    onnxscript
    onnxslim
    pandas
    plotly
    protobuf
    pydantic
    rich
    scipy
    sentencepiece
    tqdm
    zstandard
  ];

  pythonRelaxDeps = true;

  pythonImportsCheck = [ "quark" ];

  # Most of the tests require gpu and some other unspecified dependencies
  doCheck = false;

  meta = {
    description = "AMD Quark Model Optimizer";
    homepage = "https://github.com/amd/Quark";
    changelog = "https://github.com/amd/Quark/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ lach ];
  };
})