1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, pythonOlder 5, cookiecutter 6, filelock 7, huggingface-hub 8, importlib-metadata 9, regex 10, requests 11, numpy 12, packaging 13, tensorflow 14, sagemaker 15, ftfy 16, protobuf 17, scikit-learn 18, pillow 19, pyyaml 20, torch 21, tokenizers 22, tqdm 23}: 24 25buildPythonPackage rec { 26 pname = "transformers"; 27 version = "4.24.0"; 28 format = "setuptools"; 29 30 disabled = pythonOlder "3.7"; 31 32 src = fetchFromGitHub { 33 owner = "huggingface"; 34 repo = pname; 35 rev = "refs/tags/v${version}"; 36 hash = "sha256-aGtTey+QK12URZcGNaRAlcaOphON4ViZOGdigtXU1g0="; 37 }; 38 39 propagatedBuildInputs = [ 40 filelock 41 huggingface-hub 42 numpy 43 protobuf 44 packaging 45 pyyaml 46 regex 47 requests 48 tokenizers 49 tqdm 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 91 92 # Many tests require internet access. 93 doCheck = false; 94 95 pythonImportsCheck = [ 96 "transformers" 97 ]; 98 99 meta = with lib; { 100 homepage = "https://github.com/huggingface/transformers"; 101 description = "Natural Language Processing for TensorFlow 2.0 and PyTorch"; 102 changelog = "https://github.com/huggingface/transformers/releases/tag/v${version}"; 103 license = licenses.asl20; 104 platforms = platforms.unix; 105 maintainers = with maintainers; [ pashashocky ]; 106 }; 107}