aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/development/python-modules/transformers/default.nix
blob: 09ebf739d7d791671e0063e981f0b0702f71f13e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{ buildPythonPackage
, stdenv
, fetchFromGitHub
, sacremoses
, requests
, sentencepiece
, boto3
, tqdm
, regex
, numpy
, pytest
}:

buildPythonPackage rec {
  pname = "transformers";
  version = "2.2.1";

  src = fetchFromGitHub {
    owner = "huggingface";
    repo = pname;
    rev = "v${version}";
    sha256 = "1p8p3lhhiyk1xl9gpgq4vbchyz57v3w7hhvsj1r90zs3cckindl8";
  };

  propagatedBuildInputs = [ numpy sacremoses requests sentencepiece boto3 tqdm regex ];

  checkInputs = [ pytest ];
  # pretrained tries to download from s3
  checkPhase = ''
    cd transformers # avoid importing local files
    HOME=$TMPDIR pytest -k 'not pretrained_tokenizers'
  '';

  meta = with stdenv.lib; {
    homepage = "https://github.com/huggingface/transformers";
    description = "State-of-the-art Natural Language Processing for TensorFlow 2.0 and PyTorch";
    license = licenses.asl20;
    platforms = [ "x86_64-linux" ];
    maintainers = with maintainers; [ pashashocky ];
  };
}