diff --git a/pkgs/development/python-modules/colbert-ai/default.nix b/pkgs/development/python-modules/colbert-ai/default.nix index a7d707d38370..5b4ebfdeb2c4 100644 --- a/pkgs/development/python-modules/colbert-ai/default.nix +++ b/pkgs/development/python-modules/colbert-ai/default.nix @@ -32,6 +32,15 @@ buildPythonPackage rec { hash = "sha256-qNb9tOInLysI7Tf45QlgchYNhBXR5AWFdRiYt35iW6s="; }; + # ImportError: cannot import name 'AdamW' from 'transformers' + # https://github.com/stanford-futuredata/ColBERT/pull/390 + postPatch = '' + substituteInPlace colbert/training/training.py \ + --replace-fail \ + "from transformers import AdamW, get_linear_schedule_with_warmup" \ + "from transformers import get_linear_schedule_with_warmup; from torch.optim import AdamW" + ''; + pythonRemoveDeps = [ "git-python" ]; build-system = [