1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 pdm-backend,
8
9 # dependencies
10 huggingface-hub,
11 pyyaml,
12 safetensors,
13 torch,
14 torchvision,
15
16 # checks
17 expecttest,
18 pytestCheckHook,
19 pytest-timeout,
20}:
21
22buildPythonPackage rec {
23 pname = "timm";
24 version = "1.0.12";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 owner = "huggingface";
29 repo = "pytorch-image-models";
30 rev = "refs/tags/v${version}";
31 hash = "sha256-Csw9Al9AHZbqfadch6JXSsjKfEj0KcLKxFbteDkcyng=";
32 };
33
34 build-system = [ pdm-backend ];
35
36 dependencies = [
37 huggingface-hub
38 pyyaml
39 safetensors
40 torch
41 torchvision
42 ];
43
44 nativeCheckInputs = [
45 expecttest
46 pytestCheckHook
47 pytest-timeout
48 ];
49
50 pytestFlagsArray = [ "tests" ];
51
52 disabledTestPaths = [
53 # Takes too long and also tries to download models
54 "tests/test_models.py"
55 ];
56
57 disabledTests = [
58 # AttributeError: 'Lookahead' object has no attribute '_optimizer_step_pre...
59 "test_lookahead"
60 ];
61
62 pythonImportsCheck = [
63 "timm"
64 "timm.data"
65 ];
66
67 meta = {
68 description = "PyTorch image models, scripts, and pretrained weights";
69 homepage = "https://huggingface.co/docs/timm/index";
70 changelog = "https://github.com/huggingface/pytorch-image-models/blob/v${version}/README.md#whats-new";
71 license = lib.licenses.asl20;
72 maintainers = with lib.maintainers; [ bcdarwin ];
73 };
74}