blob: eb7d1b502d91683486e523ef9bda76ba0e60eb9f (
about) (
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
|
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
rustPlatform,
# tests
h5py,
numpy,
pytestCheckHook,
torch,
}:
buildPythonPackage rec {
pname = "safetensors";
version = "0.5.2";
pyproject = true;
src = fetchFromGitHub {
owner = "huggingface";
repo = "safetensors";
tag = "v${version}";
hash = "sha256-dtHHLiTgrg/a/SQ/Z1w0BsuFDClgrMsGiSTCpbJasUs=";
};
sourceRoot = "${src.name}/bindings/python";
cargoDeps = rustPlatform.fetchCargoVendor {
inherit pname src sourceRoot;
hash = "sha256-hjV2cfS/0WFyAnATt+A8X8sQLzQViDzkNI7zN0ltgpU=";
};
nativeBuildInputs = [
rustPlatform.cargoSetupHook
rustPlatform.maturinBuildHook
];
nativeCheckInputs = [
h5py
numpy
pytestCheckHook
torch
];
pytestFlagsArray = [ "tests" ];
# don't require PaddlePaddle (not in Nixpkgs), Flax, or Tensorflow (onerous) to run tests:
disabledTestPaths =
[
"tests/test_flax_comparison.py"
"tests/test_paddle_comparison.py"
"tests/test_tf_comparison.py"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# don't require mlx (not in Nixpkgs) to run tests
"tests/test_mlx_comparison.py"
];
pythonImportsCheck = [ "safetensors" ];
meta = {
homepage = "https://github.com/huggingface/safetensors";
description = "Fast (zero-copy) and safe (unlike pickle) format for storing tensors";
changelog = "https://github.com/huggingface/safetensors/releases/tag/v${version}";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ bcdarwin ];
};
}
|