about summary refs log tree commit diff
path: root/pkgs/development/python-modules/webdataset/default.nix
blob: da172aa79ff7bc71c190ff4a34d157b22fc484fe (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{
  lib,
  stdenv,
  buildPythonPackage,
  braceexpand,
  imageio,
  lmdb,
  msgpack,
  numpy,
  pytestCheckHook,
  pyyaml,
  setuptools,
  torch,
  torchvision,
  wheel,
  fetchFromGitHub,
}:
buildPythonPackage rec {
  pname = "webdataset";
  version = "0.2.100";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "webdataset";
    repo = "webdataset";
    rev = "refs/tags/${version}";
    hash = "sha256-+Rvb4VY4qBcVKM1CUkLZTQdlZklpHcuiMO8r6VNInLc=";
  };

  build-system = [
    setuptools
    wheel
  ];

  dependencies = [
    braceexpand
    numpy
    pyyaml
  ];

  nativeCheckInputs = [
    pytestCheckHook
    imageio
    torch
    torchvision
    msgpack
    lmdb
  ];

  pythonImportsCheck = [ "webdataset" ];

  disabledTests =
    [
      # requires network
      "test_batched"
      "test_cache_dir"
      "test_concurrent_download_and_open"
      "test_dataloader"
      "test_decode_handlers"
      "test_decoder"
      "test_download"
      "test_handlers"
      "test_pipe"
      "test_remote_file"
      "test_shard_syntax"
      "test_torchvision"
      "test_unbatched"
      "test_yaml3"
    ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin [
      # pickling error
      "test_background_download"
    ]
    ++ lib.optionals (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform.isDarwin) [
      "test_concurrent_access"
      # fails to patch 'init_process_group' from torch.distributed
      "TestDistributedChunkedSampler"
    ]
    ++ lib.optionals (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux) [
      # segfaults on aarch64-linux
      "test_webloader"
      "test_webloader2"
      "test_webloader_repeat"
      "test_webloader_unbatched"
    ];

  disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
    # AttributeError: <module 'torch.distributed' from /nix/store/...
    "tests/test_wids.py"

    # Issue with creating a temp file in the sandbox
    "tests/test_wids_mmtar.py"
  ];

  meta = {
    description = "High-performance Python-based I/O system for large (and small) deep learning problems, with strong support for PyTorch";
    mainProgram = "widsindex";
    homepage = "https://github.com/webdataset/webdataset";
    changelog = "https://github.com/webdataset/webdataset/releases/tag/${version}";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ iynaix ];
  };
}