1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchFromGitHub
5
6# Native build inputs
7, cython
8, pythonRelaxDepsHook
9, which
10
11# Propagated build inputs
12, cffi
13, hydra-core
14, omegaconf
15, sacrebleu
16, numpy
17, regex
18, torch
19, tqdm
20, bitarray
21, torchaudio
22, scikit-learn
23, packaging
24
25# Check inputs
26, expecttest
27, hypothesis
28, pytestCheckHook
29}:
30let
31 pname = "fairseq";
32 version = "0.12.3";
33in
34buildPythonPackage rec {
35 inherit version pname;
36
37 src = fetchFromGitHub {
38 owner = "pytorch";
39 repo = pname;
40 rev = "v${version}";
41 hash = "sha256-XX/grU5ljQCwx33miGoFc/7Uj9fZDtmhm4Fz7L4U+Bc=";
42 };
43
44 disabled = pythonOlder "3.7";
45
46 nativeBuildInputs = [
47 cython
48 pythonRelaxDepsHook
49 which
50 ];
51 pythonRelaxDeps = [
52 "hydra-core"
53 "omegaconf"
54 ];
55 propagatedBuildInputs = [
56 cffi
57 hydra-core
58 omegaconf
59 sacrebleu
60 numpy
61 regex
62 torch
63 tqdm
64 bitarray
65 torchaudio
66 scikit-learn
67 packaging
68 ];
69
70 nativeCheckInputs = [
71 expecttest
72 hypothesis
73 pytestCheckHook
74 ];
75
76 pythonImportsCheck = [ "fairseq" ];
77 preCheck = ''
78 export HOME=$TMPDIR
79 cd tests
80 '';
81
82 pytestFlagsArray = [
83 "--import-mode append"
84 ];
85 disabledTests = [
86 # this test requires xformers
87 "test_xformers_single_forward_parity"
88 # this test requires iopath
89 "test_file_io_async"
90 # these tests require network access
91 "test_s2s_transformer_checkpoint"
92 "test_librispeech_s2t_transformer_s_checkpoint"
93 "test_s2s_transformer_checkpoint"
94 "test_waitk_checkpoint"
95 "test_sotasty_es_en_600m_checkpoint"
96 "test_librispeech_s2t_conformer_s_checkpoint"
97 ];
98
99 meta = with lib; {
100 description = "Facebook AI Research Sequence-to-Sequence Toolkit";
101 homepage = "https://github.com/pytorch/fairseq";
102 license = licenses.mit;
103 platforms = platforms.linux;
104 maintainers = with maintainers; [ happysalada ];
105 };
106}