summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniƫl de Kok <me@danieldk.eu>2020-07-03 18:13:29 +0200
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2020-07-03 18:30:32 +0200
commit4855aa62fa13052fb1a3daea68971503ab07a744 (patch)
tree9e45967617d60d356fb111cc81cb91a44ecea221
parent1bc8a6eeb3449f1577fce6c1ad69b76f740909ce (diff)
downloadnixpkgs-4855aa62fa13052fb1a3daea68971503ab07a744.tar
nixpkgs-4855aa62fa13052fb1a3daea68971503ab07a744.tar.gz
nixpkgs-4855aa62fa13052fb1a3daea68971503ab07a744.tar.bz2
nixpkgs-4855aa62fa13052fb1a3daea68971503ab07a744.tar.lz
nixpkgs-4855aa62fa13052fb1a3daea68971503ab07a744.tar.xz
nixpkgs-4855aa62fa13052fb1a3daea68971503ab07a744.tar.zst
nixpkgs-4855aa62fa13052fb1a3daea68971503ab07a744.zip
python3Packages.transformers: 2.2.1 -> 3.0.1
Changelog:

https://github.com/huggingface/transformers/releases/tag/v3.0.0
https://github.com/huggingface/transformers/releases/tag/v3.0.1
-rw-r--r--pkgs/development/python-modules/transformers/default.nix66
1 files changed, 53 insertions, 13 deletions
diff --git a/pkgs/development/python-modules/transformers/default.nix b/pkgs/development/python-modules/transformers/default.nix
index 6ecc43b101b..33cb5e04959 100644
--- a/pkgs/development/python-modules/transformers/default.nix
+++ b/pkgs/development/python-modules/transformers/default.nix
@@ -1,36 +1,76 @@
 { buildPythonPackage
 , stdenv
 , fetchFromGitHub
-, sacremoses
-, requests
-, sentencepiece
 , boto3
-, tqdm
+, filelock
 , regex
+, requests
 , numpy
-, pytest
+, sacremoses
+, sentencepiece
+, timeout-decorator
+, tokenizers
+, tqdm
+, pytestCheckHook
 }:
 
 buildPythonPackage rec {
   pname = "transformers";
-  version = "2.2.1";
+  version = "3.0.1";
 
   src = fetchFromGitHub {
     owner = "huggingface";
     repo = pname;
     rev = "v${version}";
-    sha256 = "1p8p3lhhiyk1xl9gpgq4vbchyz57v3w7hhvsj1r90zs3cckindl8";
+    sha256 = "1l8l82zi021sq5dnzlbjx3wx0n4yy7k96n3m2fr893y9lfkhhd8z";
   };
 
-  propagatedBuildInputs = [ numpy sacremoses requests sentencepiece boto3 tqdm regex ];
+  propagatedBuildInputs = [
+    boto3
+    filelock
+    numpy
+    regex
+    requests
+    sacremoses
+    sentencepiece
+    tokenizers
+    tqdm
+  ];
+
+  checkInputs = [
+    pytestCheckHook
+    timeout-decorator
+  ];
 
-  checkInputs = [ pytest ];
-  # pretrained tries to download from s3
-  checkPhase = ''
-    cd transformers # avoid importing local files
-    HOME=$TMPDIR pytest -k 'not pretrained_tokenizers'
+  postPatch = ''
+    substituteInPlace setup.py \
+      --replace "tokenizers == 0.8.0-rc4" "tokenizers>=0.8,<0.9"
   '';
 
+  preCheck = ''
+    export HOME="$TMPDIR"
+    cd tests
+  '';
+
+  # Disable tests that require network access.
+  disabledTests = [
+    "test_all_tokenizers"
+    "test_batch_encoding_is_fast"
+    "test_batch_encoding_pickle"
+    "test_config_from_model_shortcut"
+    "test_config_model_type_from_model_identifier"
+    "test_from_pretrained_use_fast_toggle"
+    "test_hf_api"
+    "test_outputs_can_be_shorter"
+    "test_outputs_not_longer_than_maxlen"
+    "test_pretokenized_tokenizers"
+    "test_tokenizer_equivalence_en_de"
+    "test_tokenizer_from_model_type"
+    "test_tokenizer_from_model_type"
+    "test_tokenizer_from_pretrained"
+    "test_tokenizer_identifier_with_correct_config"
+  ];
+
   meta = with stdenv.lib; {
     homepage = "https://github.com/huggingface/transformers";
     description = "State-of-the-art Natural Language Processing for TensorFlow 2.0 and PyTorch";