about summary refs log tree commit diff
path: root/pkgs/development/python-modules/transformers/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/transformers/default.nix')
-rw-r--r--pkgs/development/python-modules/transformers/default.nix319
1 files changed, 163 insertions, 156 deletions
diff --git a/pkgs/development/python-modules/transformers/default.nix b/pkgs/development/python-modules/transformers/default.nix
index 620382cf9646a..f730d649361b8 100644
--- a/pkgs/development/python-modules/transformers/default.nix
+++ b/pkgs/development/python-modules/transformers/default.nix
@@ -1,60 +1,62 @@
-{ lib
-, buildPythonPackage
-, fetchFromGitHub
-, pythonOlder
-# 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
+{
+  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,
 }:
 
 buildPythonPackage rec {
   pname = "transformers";
-  version = "4.39.3";
-  format = "setuptools";
+  version = "4.41.2";
+  pyproject = true;
 
   disabled = pythonOlder "3.8";
 
@@ -62,10 +64,12 @@ buildPythonPackage rec {
     owner = "huggingface";
     repo = "transformers";
     rev = "refs/tags/v${version}";
-    hash = "sha256-MJZvPbj9ypr6YwFGkzwCp9fVuM3vEGpeXK+gEIFzwRA=";
+    hash = "sha256-Y3WYO+63n/ATT9RmRJ9JLuhFWUiuBO4NL2KzvzELi+M=";
   };
 
-  propagatedBuildInputs = [
+  build-system = [ setuptools ];
+
+  dependencies = [
     filelock
     huggingface-hub
     numpy
@@ -79,116 +83,119 @@ buildPythonPackage rec {
   ];
 
   passthru.optional-dependencies =
-  let
-    audio = [
-      librosa
-      # pyctcdecode
-      phonemizer
-      # kenlm
-    ];
-    vision = [ pillow ];
-  in
+    let
+      audio = [
+        librosa
+        # pyctcdecode
+        phonemizer
+        # kenlm
+      ];
+      vision = [ pillow ];
+    in
     {
-    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 ];
-  };
-
+      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
+      ];
+    };
 
   # Many tests require internet access.
   doCheck = false;
 
-  pythonImportsCheck = [
-    "transformers"
-  ];
+  pythonImportsCheck = [ "transformers" ];
 
-  meta = with lib; {
+  meta = {
     homepage = "https://github.com/huggingface/transformers";
     description = "Natural Language Processing for TensorFlow 2.0 and PyTorch";
     mainProgram = "transformers-cli";
     changelog = "https://github.com/huggingface/transformers/releases/tag/v${version}";
-    license = licenses.asl20;
-    platforms = platforms.unix;
-    maintainers = with maintainers; [ pashashocky happysalada ];
+    license = lib.licenses.asl20;
+    platforms = lib.platforms.unix;
+    maintainers = with lib.maintainers; [
+      pashashocky
+      happysalada
+    ];
   };
 }