21 buildPythonPackage rec {
26 disabled = pythonOlder "3.7";
28 src = fetchFromGitHub {
29 owner = "huggingface";
31 rev = "refs/tags/v${version}";
32 hash = "sha256-7rnI8UXyAql8fLMKoSRrWzVw5CnyYVE2o6dJOzSgWxw=";
35 nativeBuildInputs = [ setuptools ];
37 propagatedBuildInputs = [
53 export HOME=$(mktemp -d)
54 export PATH=$out/bin:$PATH
55 '' + lib.optionalString config.cudaSupport ''
56 export TRITON_PTXAS_PATH="${cudatoolkit}/bin/ptxas"
58 pytestFlagsArray = [ "tests" ];
60 # try to download data:
61 "FeatureExamplesTests"
62 "test_infer_auto_device_map_on_t0pp"
64 # require socket communication
65 "test_explicit_dtypes"
67 "test_invalid_model_name"
68 "test_invalid_model_name_transformers"
70 "test_no_split_modules"
72 "test_transformers_model"
74 # set the environment variable, CC, which conflicts with standard environment
75 "test_patch_environment_key_exists"
76 ] ++ lib.optionals (stdenv.isLinux && stdenv.isAarch64) [
77 # usual aarch64-linux RuntimeError: DataLoader worker (pid(s) <...>) exited unexpectedly
79 ] ++ lib.optionals (!config.cudaSupport) [
80 # requires ptxas from cudatoolkit, which is unfree
81 "test_dynamo_extract_model"
82 ] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
83 # RuntimeError: torch_shm_manager: execl failed: Permission denied
87 disabledTestPaths = lib.optionals (!(stdenv.isLinux && stdenv.isx86_64)) [
88 # numerous instances of torch.multiprocessing.spawn.ProcessRaisedException:
90 "tests/test_grad_sync.py"
91 "tests/test_metrics.py"
92 "tests/test_scheduler.py"
95 pythonImportsCheck = [
100 homepage = "https://huggingface.co/docs/accelerate";
101 description = "A simple way to train and use PyTorch models with multi-GPU, TPU, mixed-precision";
102 changelog = "https://github.com/huggingface/accelerate/releases/tag/v${version}";
103 license = licenses.asl20;
104 maintainers = with maintainers; [ bcdarwin ];
105 mainProgram = "accelerate";