summary refs log tree commit diff
path: root/pkgs/development/python-modules/fairseq/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/fairseq/default.nix')
-rw-r--r--pkgs/development/python-modules/fairseq/default.nix26
1 files changed, 21 insertions, 5 deletions
diff --git a/pkgs/development/python-modules/fairseq/default.nix b/pkgs/development/python-modules/fairseq/default.nix
index 92d8a5e7856..35275c32780 100644
--- a/pkgs/development/python-modules/fairseq/default.nix
+++ b/pkgs/development/python-modules/fairseq/default.nix
@@ -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";