depot/third_party/nixpkgs/pkgs/development/python-modules/transformers/default.nix
Default email 75ca762b89 Project import generated by Copybara.
GitOrigin-RevId: 29b0d4d0b600f8f5dd0b86e3362a33d4181938f9
2021-03-09 11:18:52 +08:00

57 lines
1.2 KiB
Nix

{ buildPythonPackage
, lib
, fetchFromGitHub
, pythonOlder
, cookiecutter
, filelock
, importlib-metadata
, regex
, requests
, numpy
, protobuf
, sacremoses
, tokenizers
, tqdm
}:
buildPythonPackage rec {
pname = "transformers";
version = "4.3.3";
src = fetchFromGitHub {
owner = "huggingface";
repo = pname;
rev = "v${version}";
hash = "sha256-KII7ZR+vnCxCxUcBOQo9y0KxZa+XuIIAkSJejk8HrlA=";
};
propagatedBuildInputs = [
cookiecutter
filelock
numpy
protobuf
regex
requests
sacremoses
tokenizers
tqdm
] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
# Many tests require internet access.
doCheck = false;
postPatch = ''
sed -ri 's/tokenizers[=>]=[^"]+/tokenizers/g' setup.py src/transformers/dependency_versions_table.py
'';
pythonImportsCheck = [ "transformers" ];
meta = with lib; {
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}";
license = licenses.asl20;
platforms = platforms.unix;
maintainers = with maintainers; [ danieldk pashashocky ];
};
}