Unverified Commit 6e110088 authored by Ilya Boytsov's avatar Ilya Boytsov Committed by GitHub
Browse files

fix(test): recompute Jina ColBERT rotary inv_freq cleared by transformers v5 weight loader (#39176)


Signed-off-by: default avatarIlya Boytsov <ilyaboytsov1805@gmail.com>
parent edcc37a8
......@@ -109,6 +109,14 @@ def _load_hf_model(model_name: str, hf_spec: dict, device: torch.device):
**extra,
).to(device)
model.eval()
# Transformers 5.0 weight materialization can clear non-persistent
# buffers (e.g. rotary inv_freq) that were registered with
# persistent=False. Re-compute them so the model produces valid output.
for mod in model.modules():
if hasattr(mod, "_compute_inv_freq") and hasattr(mod, "inv_freq"):
mod.inv_freq = mod._compute_inv_freq(device=device)
return model
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment