2022-06-16 17:23:12 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
2021-02-05 17:12:51 +00:00
|
|
|
, pythonOlder
|
2024-04-21 15:54:59 +00:00
|
|
|
, setuptools
|
2023-07-15 17:15:38 +00:00
|
|
|
# propagated build inputs
|
2020-07-18 16:06:22 +00:00
|
|
|
, filelock
|
2021-12-06 16:07:01 +00:00
|
|
|
, huggingface-hub
|
2020-04-24 23:36:52 +00:00
|
|
|
, numpy
|
2020-11-03 02:18:15 +00:00
|
|
|
, protobuf
|
2023-07-15 17:15:38 +00:00
|
|
|
, packaging
|
2021-12-06 16:07:01 +00:00
|
|
|
, pyyaml
|
2023-07-15 17:15:38 +00:00
|
|
|
, regex
|
|
|
|
, requests
|
2020-07-18 16:06:22 +00:00
|
|
|
, tokenizers
|
2023-07-15 17:15:38 +00:00
|
|
|
, safetensors
|
2020-07-18 16:06:22 +00:00
|
|
|
, tqdm
|
2023-07-15 17:15:38 +00:00
|
|
|
# optional dependencies
|
2024-01-25 14:12:00 +00:00
|
|
|
, diffusers
|
2023-07-15 17:15:38 +00:00
|
|
|
, scikit-learn
|
|
|
|
, tensorflow
|
|
|
|
, onnxconverter-common
|
2024-01-25 14:12:00 +00:00
|
|
|
, opencv4
|
2023-08-04 22:07:22 +00:00
|
|
|
, tf2onnx
|
2023-07-15 17:15:38 +00:00
|
|
|
, torch
|
|
|
|
, accelerate
|
|
|
|
, faiss
|
|
|
|
, datasets
|
|
|
|
, jax
|
|
|
|
, jaxlib
|
|
|
|
, flax
|
|
|
|
, optax
|
|
|
|
, ftfy
|
|
|
|
, onnxruntime
|
|
|
|
, onnxruntime-tools
|
|
|
|
, cookiecutter
|
|
|
|
, sagemaker
|
|
|
|
, fairscale
|
|
|
|
, optuna
|
|
|
|
, ray
|
|
|
|
, pydantic
|
|
|
|
, uvicorn
|
|
|
|
, fastapi
|
|
|
|
, starlette
|
|
|
|
, librosa
|
|
|
|
, phonemizer
|
|
|
|
, torchaudio
|
|
|
|
, pillow
|
|
|
|
, timm
|
|
|
|
, torchvision
|
|
|
|
, av
|
|
|
|
, sentencepiece
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "transformers";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "4.40.2";
|
2024-04-21 15:54:59 +00:00
|
|
|
pyproject = true;
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "huggingface";
|
2023-11-16 04:20:00 +00:00
|
|
|
repo = "transformers";
|
2022-06-16 17:23:12 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-GMoHWJAfQJ3y1DPs9+geNdzD72rwMVEG0GLPYEvbo/E=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
build-system = [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
filelock
|
2021-12-06 16:07:01 +00:00
|
|
|
huggingface-hub
|
2020-07-18 16:06:22 +00:00
|
|
|
numpy
|
2022-06-16 17:23:12 +00:00
|
|
|
packaging
|
2021-12-06 16:07:01 +00:00
|
|
|
pyyaml
|
2020-07-18 16:06:22 +00:00
|
|
|
regex
|
|
|
|
requests
|
|
|
|
tokenizers
|
2023-07-15 17:15:38 +00:00
|
|
|
safetensors
|
2020-07-18 16:06:22 +00:00
|
|
|
tqdm
|
2022-06-16 17:23:12 +00:00
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
passthru.optional-dependencies =
|
|
|
|
let
|
|
|
|
audio = [
|
|
|
|
librosa
|
|
|
|
# pyctcdecode
|
|
|
|
phonemizer
|
|
|
|
# kenlm
|
|
|
|
];
|
|
|
|
vision = [ pillow ];
|
|
|
|
in
|
|
|
|
{
|
2024-01-25 14:12:00 +00:00
|
|
|
agents = [
|
|
|
|
diffusers
|
|
|
|
accelerate
|
|
|
|
datasets
|
|
|
|
torch
|
|
|
|
sentencepiece
|
|
|
|
opencv4
|
|
|
|
pillow
|
|
|
|
];
|
2022-06-16 17:23:12 +00:00
|
|
|
ja = [
|
|
|
|
# fugashi
|
|
|
|
# ipadic
|
2023-08-04 22:07:22 +00:00
|
|
|
# rhoknp
|
|
|
|
# sudachidict_core
|
|
|
|
# sudachipy
|
2022-06-16 17:23:12 +00:00
|
|
|
# unidic
|
2023-08-04 22:07:22 +00:00
|
|
|
# unidic_lite
|
2022-06-16 17:23:12 +00:00
|
|
|
];
|
|
|
|
sklearn = [
|
|
|
|
scikit-learn
|
|
|
|
];
|
|
|
|
tf = [
|
|
|
|
tensorflow
|
2023-07-15 17:15:38 +00:00
|
|
|
onnxconverter-common
|
2023-08-04 22:07:22 +00:00
|
|
|
tf2onnx
|
2023-07-15 17:15:38 +00:00
|
|
|
# tensorflow-text
|
|
|
|
# keras-nlp
|
2022-06-16 17:23:12 +00:00
|
|
|
];
|
|
|
|
torch = [
|
2022-09-09 14:08:57 +00:00
|
|
|
torch
|
2023-07-15 17:15:38 +00:00
|
|
|
accelerate
|
2022-06-16 17:23:12 +00:00
|
|
|
];
|
2023-07-15 17:15:38 +00:00
|
|
|
retrieval = [ faiss datasets ];
|
|
|
|
flax = [ jax jaxlib flax optax ];
|
2022-06-16 17:23:12 +00:00
|
|
|
tokenizers = [
|
|
|
|
tokenizers
|
|
|
|
];
|
2023-07-15 17:15:38 +00:00
|
|
|
ftfy = [ ftfy ];
|
|
|
|
onnxruntime = [
|
|
|
|
onnxruntime
|
|
|
|
onnxruntime-tools
|
|
|
|
];
|
|
|
|
onnx = [
|
|
|
|
onnxconverter-common
|
2023-08-04 22:07:22 +00:00
|
|
|
tf2onnx
|
2023-07-15 17:15:38 +00:00
|
|
|
onnxruntime
|
2023-08-04 22:07:22 +00:00
|
|
|
onnxruntime-tools
|
2023-07-15 17:15:38 +00:00
|
|
|
];
|
2022-06-16 17:23:12 +00:00
|
|
|
modelcreation = [
|
|
|
|
cookiecutter
|
|
|
|
];
|
|
|
|
sagemaker = [
|
|
|
|
sagemaker
|
|
|
|
];
|
2023-07-15 17:15:38 +00:00
|
|
|
deepspeed = [
|
|
|
|
# deepspeed
|
|
|
|
accelerate
|
|
|
|
];
|
|
|
|
fairscale = [ fairscale ];
|
|
|
|
optuna = [ optuna ];
|
|
|
|
ray = [ ray ] ++ ray.optional-dependencies.tune-deps;
|
|
|
|
# sigopt = [ sigopt ];
|
|
|
|
# integrations = ray ++ optuna ++ sigopt;
|
|
|
|
serving = [
|
|
|
|
pydantic
|
|
|
|
uvicorn
|
|
|
|
fastapi
|
|
|
|
starlette
|
2022-06-16 17:23:12 +00:00
|
|
|
];
|
2023-07-15 17:15:38 +00:00
|
|
|
audio = audio;
|
|
|
|
speech = [ torchaudio ] ++ audio;
|
|
|
|
torch-speech = [ torchaudio ] ++ audio;
|
|
|
|
tf-speech = audio;
|
|
|
|
flax-speech = audio;
|
|
|
|
timm = [ timm ];
|
|
|
|
torch-vision = [ torchvision ] ++ vision;
|
|
|
|
# natten = [ natten ];
|
|
|
|
# codecarbon = [ codecarbon ];
|
|
|
|
video = [
|
|
|
|
# decord
|
|
|
|
av
|
2022-06-16 17:23:12 +00:00
|
|
|
];
|
2023-07-15 17:15:38 +00:00
|
|
|
sentencepiece = [ sentencepiece protobuf ];
|
2022-06-16 17:23:12 +00:00
|
|
|
};
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
# Many tests require internet access.
|
|
|
|
doCheck = false;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"transformers"
|
|
|
|
];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/huggingface/transformers";
|
2022-06-16 17:23:12 +00:00
|
|
|
description = "Natural Language Processing for TensorFlow 2.0 and PyTorch";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "transformers-cli";
|
2020-09-25 04:45:31 +00:00
|
|
|
changelog = "https://github.com/huggingface/transformers/releases/tag/v${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2020-08-20 17:08:02 +00:00
|
|
|
platforms = platforms.unix;
|
2023-07-15 17:15:38 +00:00
|
|
|
maintainers = with maintainers; [ pashashocky happysalada ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|