nixpkgs/pkgs/development/python-modules/transformers/default.nix

58 lines
1.2 KiB
Nix
Raw Normal View History

2019-12-06 18:40:29 +00:00
{ buildPythonPackage
, lib
2019-12-06 18:40:29 +00:00
, fetchFromGitHub
, pythonOlder
, cookiecutter
, filelock
, importlib-metadata
2019-12-06 18:40:29 +00:00
, regex
, requests
2019-12-06 18:40:29 +00:00
, numpy
, protobuf
, sacremoses
, tokenizers
, tqdm
2019-12-06 18:40:29 +00:00
}:
buildPythonPackage rec {
pname = "transformers";
version = "4.4.2";
2019-12-06 18:40:29 +00:00
src = fetchFromGitHub {
owner = "huggingface";
repo = pname;
rev = "v${version}";
hash = "sha256-kl1Z2FBo+yqVXUqLaUtet6IycmdcAtfydNTI4MNNrkc=";
2019-12-06 18:40:29 +00:00
};
propagatedBuildInputs = [
cookiecutter
filelock
numpy
protobuf
regex
requests
sacremoses
tokenizers
tqdm
] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
# Many tests require internet access.
doCheck = false;
2019-12-06 18:40:29 +00:00
postPatch = ''
sed -ri 's/tokenizers[=>]=[^"]+/tokenizers/g' setup.py src/transformers/dependency_versions_table.py
'';
pythonImportsCheck = [ "transformers" ];
meta = with lib; {
2019-12-06 18:40:29 +00:00
homepage = "https://github.com/huggingface/transformers";
description = "State-of-the-art Natural Language Processing for TensorFlow 2.0 and PyTorch";
changelog = "https://github.com/huggingface/transformers/releases/tag/v${version}";
2019-12-06 18:40:29 +00:00
license = licenses.asl20;
platforms = platforms.unix;
maintainers = with maintainers; [ danieldk pashashocky ];
2019-12-06 18:40:29 +00:00
};
}