python3Packages.fairseq: fix python 3.11 build

This commit is contained in:
Madoura 2023-10-27 12:23:07 -05:00
parent 96619a0984
commit 77ab93a3ee
No known key found for this signature in database
GPG Key ID: 1B9BB76A2B71922D

View File

@ -2,6 +2,7 @@
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, fetchpatch
# Native build inputs
, cython
@ -27,12 +28,12 @@
, hypothesis
, pytestCheckHook
}:
let
buildPythonPackage rec {
pname = "fairseq";
version = "0.12.3";
in
buildPythonPackage rec {
inherit version pname;
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "pytorch";
@ -41,17 +42,25 @@ buildPythonPackage rec {
hash = "sha256-XX/grU5ljQCwx33miGoFc/7Uj9fZDtmhm4Fz7L4U+Bc=";
};
disabled = pythonOlder "3.7";
patches = [
# https://github.com/facebookresearch/fairseq/pull/5359
(fetchpatch {
url = "https://github.com/facebookresearch/fairseq/commit/2fa0768c2115b0a4c207cfa3e1b3e4ff3ad9a00c.patch";
hash = "sha256-aYYP/knQX6q6vhyA6q9uOOYfRhDAuJCo9QJWfFEDuuA=";
})
];
nativeBuildInputs = [
cython
pythonRelaxDepsHook
which
];
pythonRelaxDeps = [
"hydra-core"
"omegaconf"
];
propagatedBuildInputs = [
cffi
hydra-core
@ -74,6 +83,7 @@ buildPythonPackage rec {
];
pythonImportsCheck = [ "fairseq" ];
preCheck = ''
export HOME=$TMPDIR
cd tests
@ -82,6 +92,7 @@ buildPythonPackage rec {
pytestFlagsArray = [
"--import-mode append"
];
disabledTests = [
# this test requires xformers
"test_xformers_single_forward_parity"
@ -96,6 +107,11 @@ buildPythonPackage rec {
"test_librispeech_s2t_conformer_s_checkpoint"
];
disabledTestPaths = [
# ValueError: mutable default ... for field bar is not allowed: use default_factory
"test_dataclass_utils.py"
];
meta = with lib; {
description = "Facebook AI Research Sequence-to-Sequence Toolkit";
homepage = "https://github.com/pytorch/fairseq";