Skip to content

Make HF backend compatible with transformers 5.9 - #86

Merged
yairallouche merged 1 commit into
mainfrom
bugfix/transformers-5.9-compat
Jun 2, 2026
Merged

yairallouche merged 1 commit into
mainfrom
bugfix/transformers-5.9-compat

Conversation

@barvhaim

@barvhaim barvhaim commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

transformers.masking_utils.create_causal_mask changed signature in 5.9.0: the input_embeds kwarg was renamed to inputs_embeds, and cache_position was deprecated and removed (it had been unused).

Apply version-dispatch at the call site to keep working on 5.5–5.8 while supporting 5.9. The probe is module-level next to the existing transformers imports; the kwargs dict is inline at the single call site in modeling_granite_switch.py.

Verified 5.9 still only reads batch/seq-length/dtype/device from inputs_embeds, so the existing (B, S, 1) mask_shape_proxy stub stays valid — no other adjustments needed.

Bump pyproject constraint from <5.9.0 to <5.10.0 to allow installs on 5.9.x.

Refs #63

`transformers.masking_utils.create_causal_mask` changed signature in 5.9.0:
the `input_embeds` kwarg was renamed to `inputs_embeds`, and `cache_position`
was deprecated and removed (it had been unused).

Apply Option B (version-dispatch at the call site) to keep working on
5.5–5.8 while supporting 5.9. The probe is module-level next to the
existing transformers imports; the kwargs dict is inline at the single
call site in modeling_granite_switch.py.

Verified 5.9 still only reads batch/seq-length/dtype/device from
`inputs_embeds`, so the existing (B, S, 1) `mask_shape_proxy` stub stays
valid — no other adjustments needed.

Bump pyproject constraint from `<5.9.0` to `<5.10.0` to allow installs on
5.9.x.

Refs #63
@barvhaim
barvhaim marked this pull request as ready for review June 1, 2026 13:49
@yairallouche
yairallouche merged commit 60d546d into main Jun 2, 2026
@barvhaim
barvhaim deleted the bugfix/transformers-5.9-compat branch June 23, 2026 11:18
yairallouche pushed a commit that referenced this pull request Sep 8, 2026
vedem1192 pushed a commit to vedem1192/granite-switch that referenced this pull request Nov 20, 2026
…g#86)

`transformers.masking_utils.create_causal_mask` changed signature in 5.9.0:
the `input_embeds` kwarg was renamed to `inputs_embeds`, and `cache_position`
was deprecated and removed (it had been unused).

Apply Option B (version-dispatch at the call site) to keep working on
5.5–5.8 while supporting 5.9. The probe is module-level next to the
existing transformers imports; the kwargs dict is inline at the single
call site in modeling_granite_switch.py.

Verified 5.9 still only reads batch/seq-length/dtype/device from
`inputs_embeds`, so the existing (B, S, 1) `mask_shape_proxy` stub stays
valid — no other adjustments needed.

Bump pyproject constraint from `<5.9.0` to `<5.10.0` to allow installs on
5.9.x.

Refs generative-computing#63
vedem1192 pushed a commit to vedem1192/granite-switch that referenced this pull request Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants