Merge pull request #175086 from fabaff/spacy-transformers-fix

python310Packages.spacy-transformers: relax transformers constraint

authored by

Fabian Affolter and committed by
GitHub
075bcccc 6c09a192

+63 -15
+5
pkgs/development/python-modules/spacy-transformers/default.nix
··· 33 33 dataclasses 34 34 ]; 35 35 36 + postPatch = '' 37 + substituteInPlace setup.cfg \ 38 + --replace "transformers>=3.4.0,<4.18.0" "transformers>=3.4.0 # ,<4.18.0" 39 + ''; 40 + 36 41 # Test fails due to missing arguments for trfs2arrays(). 37 42 doCheck = false; 38 43
+58 -15
pkgs/development/python-modules/transformers/default.nix
··· 1 - { buildPythonPackage 2 - , lib 1 + { lib 2 + , buildPythonPackage 3 3 , fetchFromGitHub 4 4 , pythonOlder 5 5 , cookiecutter ··· 10 10 , requests 11 11 , numpy 12 12 , packaging 13 + , tensorflow 14 + , sagemaker 15 + , ftfy 13 16 , protobuf 17 + , scikit-learn 18 + , pillow 14 19 , pyyaml 15 - , sacremoses 20 + , torch 16 21 , tokenizers 17 22 , tqdm 18 23 }: ··· 20 25 buildPythonPackage rec { 21 26 pname = "transformers"; 22 27 version = "4.19.2"; 28 + format = "setuptools"; 29 + 30 + disabled = pythonOlder "3.7"; 23 31 24 32 src = fetchFromGitHub { 25 33 owner = "huggingface"; 26 34 repo = pname; 27 35 rev = "refs/tags/v${version}"; 28 - sha256 = "sha256-9r/1vW7Rhv9+Swxdzu5PTnlQlT8ofJeZamHf5X4ql8w="; 36 + hash = "sha256-9r/1vW7Rhv9+Swxdzu5PTnlQlT8ofJeZamHf5X4ql8w="; 29 37 }; 30 38 31 - nativeBuildInputs = [ packaging ]; 32 - 33 39 propagatedBuildInputs = [ 34 - cookiecutter 35 40 filelock 36 41 huggingface-hub 37 42 numpy 38 43 protobuf 44 + packaging 39 45 pyyaml 40 46 regex 41 47 requests 42 - sacremoses 43 48 tokenizers 44 49 tqdm 45 - ] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ]; 50 + ] ++ lib.optionals (pythonOlder "3.8") [ 51 + importlib-metadata 52 + ]; 53 + 54 + passthru.optional-dependencies = { 55 + ja = [ 56 + # fugashi 57 + # ipadic 58 + # unidic_lite 59 + # unidic 60 + ]; 61 + sklearn = [ 62 + scikit-learn 63 + ]; 64 + tf = [ 65 + tensorflow 66 + # onnxconverter-common 67 + # tf2onnx 68 + ]; 69 + torch = [ 70 + torch 71 + ]; 72 + tokenizers = [ 73 + tokenizers 74 + ]; 75 + modelcreation = [ 76 + cookiecutter 77 + ]; 78 + sagemaker = [ 79 + sagemaker 80 + ]; 81 + ftfy = [ ftfy ]; 82 + onnx = [ 83 + # onnxconverter-common 84 + # tf2onnx 85 + ]; 86 + vision = [ 87 + pillow 88 + ]; 89 + }; 90 + 46 91 47 92 # Many tests require internet access. 48 93 doCheck = false; 49 94 50 - postPatch = '' 51 - sed -ri 's/tokenizers[=>]=[^"]+/tokenizers/g' setup.py src/transformers/dependency_versions_table.py 52 - ''; 53 - 54 - pythonImportsCheck = [ "transformers" ]; 95 + pythonImportsCheck = [ 96 + "transformers" 97 + ]; 55 98 56 99 meta = with lib; { 57 100 homepage = "https://github.com/huggingface/transformers"; 58 - description = "State-of-the-art Natural Language Processing for TensorFlow 2.0 and PyTorch"; 101 + description = "Natural Language Processing for TensorFlow 2.0 and PyTorch"; 59 102 changelog = "https://github.com/huggingface/transformers/releases/tag/v${version}"; 60 103 license = licenses.asl20; 61 104 platforms = platforms.unix;