Support Transformers 5

#1
by kashif HF Staff - opened
Hugging Face Biology Research org
β€’
edited about 20 hours ago

Makes the model load correctly with Transformers 5.x while keeping 4.56+ working.

  • modeling_generanno.py: compute default RoPE inverse frequencies locally (v5 dropped ROPE_INIT_FUNCTIONS["default"]), register original_inv_freq as a buffer, and recompute RoPE buffers in _init_weights. Without this, v5 loads the model with uninitialized inv_freq buffers and produces wrong predictions without any error.
  • requirements.txt: transformers>=4.56,<6; drop the huggingface_hub<1 pin.
  • infer_packed.py: torch_dtype= β†’ dtype=.
  • README: download/install steps in a working order, a minimal Python example, and a note on full-length attention memory.
  • INFERENCE.md: drop the pinned-version statement. provenance.json: record modeling_generanno.py as modified from the source.

Checked on 4.56.0, 4.57.6 and 5.17.0: all checkpoint tensors load unchanged, and predictions are bit-identical to the current code on 4.56.0.

cgeorgiaw changed pull request status to merged

Sign up or log in to comment