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