1{ buildPythonPackage
2, stdenv
3, fetchFromGitHub
4, sacremoses
5, requests
6, sentencepiece
7, boto3
8, tqdm
9, regex
10, numpy
11, pytest
12}:
13
14buildPythonPackage rec {
15 pname = "transformers";
16 version = "2.2.1";
17
18 src = fetchFromGitHub {
19 owner = "huggingface";
20 repo = pname;
21 rev = "v${version}";
22 sha256 = "1p8p3lhhiyk1xl9gpgq4vbchyz57v3w7hhvsj1r90zs3cckindl8";
23 };
24
25 propagatedBuildInputs = [ numpy sacremoses requests sentencepiece boto3 tqdm regex ];
26
27 checkInputs = [ pytest ];
28 # pretrained tries to download from s3
29 checkPhase = ''
30 cd transformers # avoid importing local files
31 HOME=$TMPDIR pytest -k 'not pretrained_tokenizers'
32 '';
33
34 meta = with stdenv.lib; {
35 homepage = "https://github.com/huggingface/transformers";
36 description = "State-of-the-art Natural Language Processing for TensorFlow 2.0 and PyTorch";
37 license = licenses.asl20;
38 platforms = [ "x86_64-linux" ];
39 maintainers = with maintainers; [ pashashocky ];
40 };
41}