2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
pythonOlder,
|
|
|
|
fetchFromGitHub,
|
|
|
|
fetchpatch,
|
|
|
|
|
|
|
|
# Native build inputs
|
|
|
|
cython,
|
|
|
|
which,
|
|
|
|
|
|
|
|
# Propagated build inputs
|
|
|
|
cffi,
|
|
|
|
hydra-core,
|
|
|
|
omegaconf,
|
|
|
|
sacrebleu,
|
|
|
|
numpy,
|
|
|
|
regex,
|
|
|
|
torch,
|
|
|
|
tqdm,
|
|
|
|
bitarray,
|
|
|
|
torchaudio,
|
|
|
|
scikit-learn,
|
|
|
|
packaging,
|
|
|
|
|
|
|
|
# Check inputs
|
|
|
|
expecttest,
|
|
|
|
hypothesis,
|
|
|
|
pytestCheckHook,
|
2023-07-15 17:15:38 +00:00
|
|
|
}:
|
2023-11-16 04:20:00 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2023-07-15 17:15:38 +00:00
|
|
|
pname = "fairseq";
|
|
|
|
version = "0.12.3";
|
2023-11-16 04:20:00 +00:00
|
|
|
pyproject = true;
|
|
|
|
disabled = pythonOlder "3.7";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pytorch";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-XX/grU5ljQCwx33miGoFc/7Uj9fZDtmhm4Fz7L4U+Bc=";
|
|
|
|
};
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
patches = [
|
|
|
|
# https://github.com/facebookresearch/fairseq/pull/5359
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/facebookresearch/fairseq/commit/2fa0768c2115b0a4c207cfa3e1b3e4ff3ad9a00c.patch";
|
|
|
|
hash = "sha256-aYYP/knQX6q6vhyA6q9uOOYfRhDAuJCo9QJWfFEDuuA=";
|
|
|
|
})
|
|
|
|
];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cython
|
|
|
|
which
|
|
|
|
];
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
pythonRelaxDeps = [
|
|
|
|
"hydra-core"
|
|
|
|
"omegaconf"
|
|
|
|
];
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
cffi
|
|
|
|
hydra-core
|
|
|
|
omegaconf
|
|
|
|
sacrebleu
|
|
|
|
numpy
|
|
|
|
regex
|
|
|
|
torch
|
|
|
|
tqdm
|
|
|
|
bitarray
|
|
|
|
torchaudio
|
|
|
|
scikit-learn
|
|
|
|
packaging
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
expecttest
|
|
|
|
hypothesis
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "fairseq" ];
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
preCheck = ''
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
cd tests
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pytestFlagsArray = [ "--import-mode append" ];
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
disabledTests = [
|
|
|
|
# this test requires xformers
|
|
|
|
"test_xformers_single_forward_parity"
|
2024-04-21 15:54:59 +00:00
|
|
|
"test_mask_for_xformers"
|
2023-07-15 17:15:38 +00:00
|
|
|
# this test requires iopath
|
|
|
|
"test_file_io_async"
|
|
|
|
# these tests require network access
|
|
|
|
"test_s2s_transformer_checkpoint"
|
|
|
|
"test_librispeech_s2t_transformer_s_checkpoint"
|
|
|
|
"test_s2s_transformer_checkpoint"
|
|
|
|
"test_waitk_checkpoint"
|
|
|
|
"test_sotasty_es_en_600m_checkpoint"
|
|
|
|
"test_librispeech_s2t_conformer_s_checkpoint"
|
2024-04-21 15:54:59 +00:00
|
|
|
# TODO research failure
|
|
|
|
"test_multilingual_translation_latent_depth"
|
2023-07-15 17:15:38 +00:00
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
disabledTestPaths = [
|
|
|
|
# ValueError: mutable default ... for field bar is not allowed: use default_factory
|
|
|
|
"test_dataclass_utils.py"
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Facebook AI Research Sequence-to-Sequence Toolkit";
|
|
|
|
homepage = "https://github.com/pytorch/fairseq";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.linux;
|
2024-06-05 15:53:02 +00:00
|
|
|
hydraPlatforms = [ ];
|
2023-07-15 17:15:38 +00:00
|
|
|
maintainers = with maintainers; [ happysalada ];
|
|
|
|
};
|
|
|
|
}
|