2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pythonOlder,
|
|
|
|
setuptools,
|
|
|
|
# propagated build inputs
|
|
|
|
filelock,
|
|
|
|
huggingface-hub,
|
|
|
|
numpy,
|
|
|
|
protobuf,
|
|
|
|
packaging,
|
|
|
|
pyyaml,
|
|
|
|
regex,
|
|
|
|
requests,
|
|
|
|
tokenizers,
|
|
|
|
safetensors,
|
|
|
|
tqdm,
|
|
|
|
# optional dependencies
|
|
|
|
diffusers,
|
|
|
|
scikit-learn,
|
|
|
|
tensorflow,
|
|
|
|
onnxconverter-common,
|
|
|
|
opencv4,
|
|
|
|
tf2onnx,
|
|
|
|
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-06-05 15:53:02 +00:00
|
|
|
version = "4.41.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-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-Y3WYO+63n/ATT9RmRJ9JLuhFWUiuBO4NL2KzvzELi+M=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
build-system = [ setuptools ];
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
dependencies = [
|
2020-07-18 16:06:22 +00:00
|
|
|
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 =
|
2024-06-05 15:53:02 +00:00
|
|
|
let
|
|
|
|
audio = [
|
|
|
|
librosa
|
|
|
|
# pyctcdecode
|
|
|
|
phonemizer
|
|
|
|
# kenlm
|
|
|
|
];
|
|
|
|
vision = [ pillow ];
|
|
|
|
in
|
2023-07-15 17:15:38 +00:00
|
|
|
{
|
2024-06-05 15:53:02 +00:00
|
|
|
agents = [
|
|
|
|
diffusers
|
|
|
|
accelerate
|
|
|
|
datasets
|
|
|
|
torch
|
|
|
|
sentencepiece
|
|
|
|
opencv4
|
|
|
|
pillow
|
|
|
|
];
|
|
|
|
ja = [
|
|
|
|
# fugashi
|
|
|
|
# ipadic
|
|
|
|
# rhoknp
|
|
|
|
# sudachidict_core
|
|
|
|
# sudachipy
|
|
|
|
# unidic
|
|
|
|
# unidic_lite
|
|
|
|
];
|
|
|
|
sklearn = [ scikit-learn ];
|
|
|
|
tf = [
|
|
|
|
tensorflow
|
|
|
|
onnxconverter-common
|
|
|
|
tf2onnx
|
|
|
|
# tensorflow-text
|
|
|
|
# keras-nlp
|
|
|
|
];
|
|
|
|
torch = [
|
|
|
|
torch
|
|
|
|
accelerate
|
|
|
|
];
|
|
|
|
retrieval = [
|
|
|
|
faiss
|
|
|
|
datasets
|
|
|
|
];
|
|
|
|
flax = [
|
|
|
|
jax
|
|
|
|
jaxlib
|
|
|
|
flax
|
|
|
|
optax
|
|
|
|
];
|
|
|
|
tokenizers = [ tokenizers ];
|
|
|
|
ftfy = [ ftfy ];
|
|
|
|
onnxruntime = [
|
|
|
|
onnxruntime
|
|
|
|
onnxruntime-tools
|
|
|
|
];
|
|
|
|
onnx = [
|
|
|
|
onnxconverter-common
|
|
|
|
tf2onnx
|
|
|
|
onnxruntime
|
|
|
|
onnxruntime-tools
|
|
|
|
];
|
|
|
|
modelcreation = [ cookiecutter ];
|
|
|
|
sagemaker = [ sagemaker ];
|
|
|
|
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
|
|
|
|
];
|
|
|
|
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
|
|
|
|
];
|
|
|
|
sentencepiece = [
|
|
|
|
sentencepiece
|
|
|
|
protobuf
|
|
|
|
];
|
|
|
|
};
|
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
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "transformers" ];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
meta = {
|
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}";
|
2024-06-05 15:53:02 +00:00
|
|
|
license = lib.licenses.asl20;
|
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
pashashocky
|
|
|
|
happysalada
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|