Skip to content

🚨 Fix GPTBigCode and GPTNeoX for the Transformers modelling backend for vLLM - #47198

Merged
ArthurZucker merged 9 commits into
huggingface:mainfrom
hmellor:fix-some-gpts
Jul 14, 2026
Merged

ArthurZucker merged 9 commits into
huggingface:mainfrom
hmellor:fix-some-gpts

Conversation

@hmellor

@hmellor hmellor commented Jul 9, 2026 •

Copy link
Copy Markdown
Member

CI

  • Adds a remapping from embed_out to lm_head for GPTNeoX
  • Adds _supports_attention_backend = True to GPTBigCode because it does

hmellor added 4 commits July 9, 2026 07:33
Signed-off-by: Harry Mellor <[email protected]>
Signed-off-by: Harry Mellor <[email protected]>
Signed-off-by: Harry Mellor <[email protected]>
_skip_keys_device_placement = ["past_key_values"]
_supports_flash_attn = True
_supports_sdpa = True
_supports_attention_backend = True

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its weird that it does not auto detect it n o? normally it reads the code to seeif attn interface is used. can you check why it failed here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is auto-detection supposed to happen?

The method in Transformers just checks for this class attribute:

@classmethod
def is_backend_compatible(cls):
return cls._supports_attention_backend

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh my bad then might have been there at some point in can_set_attn_implementation ? they don't oberlap i guess

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's nice, I didn't know about this method. As a follow up I can update is_backend_compatible to check this as well as the kwargs passing and then _supports_attention_backend becomes redundant

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@hmellor
hmellor enabled auto-merge July 9, 2026 08:57
@hmellor hmellor changed the title Fix GPTBigCode and GPTNeoX for the Transformers modelling backend for vLLM 🚨 Fix GPTBigCode and GPTNeoX for the Transformers modelling backend for vLLM Jul 9, 2026
@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: gpt_bigcode, gpt_neox

@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 29238308208:1
Result: failure | Jobs: 15 | Tests: 171,041 | Failures: 1 | Duration: 23m 48s

@ArthurZucker
ArthurZucker disabled auto-merge July 14, 2026 15:25
@ArthurZucker
ArthurZucker merged commit 70b1ee2 into huggingface:main Jul 14, 2026
101 of 103 checks passed
louzongzhi pushed a commit to louzongzhi/transformers that referenced this pull request Jul 14, 2026
…or vLLM (huggingface#47198)

* Fix GPTBigCode and GPTNeoX for the Transformers modelling backend for vLLM

Signed-off-by: Harry Mellor <[email protected]>

* make style

Signed-off-by: Harry Mellor <[email protected]>

* unnecessary change

Signed-off-by: Harry Mellor <[email protected]>

* remove pointless comment

Signed-off-by: Harry Mellor <[email protected]>

* Only apply to causal class

Signed-off-by: Harry Mellor <[email protected]>

---------

Signed-off-by: Harry Mellor <[email protected]>
@hmellor
hmellor deleted the fix-some-gpts branch July 14, 2026 18:34
stevhliu pushed a commit to stevhliu/transformers that referenced this pull request Jul 30, 2026
…or vLLM (huggingface#47198)

* Fix GPTBigCode and GPTNeoX for the Transformers modelling backend for vLLM

Signed-off-by: Harry Mellor <[email protected]>

* make style

Signed-off-by: Harry Mellor <[email protected]>

* unnecessary change

Signed-off-by: Harry Mellor <[email protected]>

* remove pointless comment

Signed-off-by: Harry Mellor <[email protected]>

* Only apply to causal class

Signed-off-by: Harry Mellor <[email protected]>

---------

Signed-off-by: Harry Mellor <[email protected]>
Sainava pushed a commit to Sainava/Sai-transformers that referenced this pull request Aug 3, 2026
…or vLLM (huggingface#47198)

* Fix GPTBigCode and GPTNeoX for the Transformers modelling backend for vLLM

Signed-off-by: Harry Mellor <[email protected]>

* make style

Signed-off-by: Harry Mellor <[email protected]>

* unnecessary change

Signed-off-by: Harry Mellor <[email protected]>

* remove pointless comment

Signed-off-by: Harry Mellor <[email protected]>

* Only apply to causal class

Signed-off-by: Harry Mellor <[email protected]>

---------

Signed-off-by: Harry Mellor <[email protected]>
janmenjayap added a commit to janmenjayap/TransformerLens that referenced this pull request Sep 10, 2026
…5.14.0

- The GPTNeoXForCausalLM embed_out→lm_head rename landed in transformers 5.14.0 (huggingface/transformers#47198), not 5.13; fix the docstring/comment/test references that said 5.13 or ~5.14
- Rename test_unembed_resolves_against_transformers_5_13_lm_head_layout to _5_14_ so it no longer contradicts the locked-5.13.0-still-has-embed_out fallback test
- Leave the four "locked 5.13.0 still exposes embed_out" notes unchanged — that pairing is correct
jlarson4 pushed a commit to TransformerLensOrg/TransformerLens that referenced this pull request Sep 10, 2026
…1752)

* fix(neox): resolve unembedding as lm_head for transformers >= 5.13

- Map the NeoX bridge unembed component to `lm_head` instead of the removed
  `embed_out`, so `TransformerBridge.boot_transformers` boots GPT-NeoX/Pythia
  on the pinned transformers 5.13.0 instead of raising
  `AttributeError: 'GPTNeoXForCausalLM' object has no attribute 'embed_out'`.
- Mirror the same rename on the HookedTransformer weight-conversion path so the
  bridge and legacy systems stay consistent (AGENTS §2).
- Found while generalizing Backward Lens to dense-MLP families, which needs
  pythia-70m as an `out_in` integration model.

* test(neox): cover unembedding resolution on the transformers >= 5.13 layout

- Update the top-level HF-path assertion to expect the `lm_head` unembed name.
- Add a model-free regression test that resolves the unembed component against a
  module exposing `lm_head` (and not `embed_out`) via `get_remote_component`,
  guarding against reintroducing the stale name that broke GPT-NeoX/Pythia boot.

* fix(neox): resolve unembedding on both embed_out and lm_head layouts

CI's locked transformers==5.13.0 still exposes embed_out; the earlier
lm_head-only rename only matched later transformers versions (5.15.1 in the
local conda env), breaking every pythia/GPT-NeoX boot in CI. Resolve the
unembed name at runtime (bridge: ArchitectureAdapter.prepare_model once the
real HF module is available; HookedTransformer: hasattr in
convert_neox_weights) so both layouts work.

* fix(neox): guard component_mapping before unembed lookup

- assert component_mapping is not None in prepare_model before indexing "unembed"
- narrows ComponentMapping | None so mypy allows the subscript (fixes index error)

* fix(neox): correct transformers embed_out→lm_head rename boundary to 5.14.0

- The GPTNeoXForCausalLM embed_out→lm_head rename landed in transformers 5.14.0 (huggingface/transformers#47198), not 5.13; fix the docstring/comment/test references that said 5.13 or ~5.14
- Rename test_unembed_resolves_against_transformers_5_13_lm_head_layout to _5_14_ so it no longer contradicts the locked-5.13.0-still-has-embed_out fallback test
- Leave the four "locked 5.13.0 still exposes embed_out" notes unchanged — that pairing is correct

* refactor(neox): set unembed name via components accessor in prepare_model

- Replace the redundant `assert component_mapping is not None` +
  `isinstance(unembed, UnembeddingBridge)` guard with a direct
  `self.components["unembed"].name = "embed_out"` assignment.
- The `components` accessor already asserts the mapping is built and
  `.name` is declared on GeneralizedComponent, matching how bert.py and
  other adapters edit their mapping; keep the hasattr `if` guard as-is.
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.

3 participants