23 # optional-dependencies
60 buildPythonPackage rec {
61 pname = "transformers";
65 src = fetchFromGitHub {
66 owner = "huggingface";
67 repo = "transformers";
69 hash = "sha256-TQQ+w+EH/KWLE7iaaAHGxfE74hCiLXcqlIr1TIBFGvo=";
72 # torch.distributed is not available on darwin
73 # Fix submitted upstream in https://github.com/huggingface/transformers/pull/35133
74 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
75 substituteInPlace src/transformers/pytorch_utils.py \
77 'if is_torch_greater_or_equal("2.5"):' \
81 build-system = [ setuptools ];
96 optional-dependencies =
125 sklearn = [ scikit-learn ];
147 tokenizers = [ tokenizers ];
159 modelcreation = [ cookiecutter ];
160 sagemaker = [ sagemaker ];
165 fairscale = [ fairscale ];
167 ray = [ ray ] ++ ray.optional-dependencies.tune;
168 # sigopt = [ sigopt ];
169 # integrations = ray ++ optuna ++ sigopt;
177 speech = [ torchaudio ] ++ audio;
178 torch-speech = [ torchaudio ] ++ audio;
182 torch-vision = [ torchvision ] ++ vision;
183 # natten = [ natten ];
184 # codecarbon = [ codecarbon ];
194 # Many tests require internet access.
197 pythonImportsCheck = [ "transformers" ];
200 homepage = "https://github.com/huggingface/transformers";
201 description = "Natural Language Processing for TensorFlow 2.0 and PyTorch";
202 mainProgram = "transformers-cli";
203 changelog = "https://github.com/huggingface/transformers/releases/tag/v${version}";
204 license = lib.licenses.asl20;
205 platforms = lib.platforms.unix;
206 maintainers = with lib.maintainers; [