Skip to content

Conversation

@tobyliu2004
Copy link

What does this PR do?

Fixes #43572

Adds the missing pad_token_id parameter to StableLmConfig to resolve the AttributeError when creating StableLM models from config.

Changes made:

  • Added pad_token_id parameter to __init__ method (defaults to None)
  • Added self.pad_token_id = pad_token_id assignment
  • Updated docstring to document the new parameter

Testing:

Verified that AutoModelForCausalLM.from_config(StableLmConfig()) now works without errors.

Before submitting

  • This PR fixes a bug
  • Code follows existing patterns (matches bos_token_id and eos_token_id)
  • Documentation updated in docstring

cc @ArthurZucker @Cyrilvallez @itazap

- Adds pad_token_id parameter to __init__ (defaults to None)
- Adds pad_token_id assignment in config initialization
- Updates docstring to document the new parameter
- Fixes AttributeError when creating StableLM models from config

Fixes huggingface#43572
@mario-aws
Copy link
Contributor

@tobyliu2004
Copy link
Author

tobyliu2004 commented Jan 29, 2026

Thanks for reviewing!
You're right, I think a test would be a good idea, I've just added an automated test in test_modeling_stablelm.py that verifies StableLmConfig has the pad_token_id attribute and that models can be instantiated from config without errors. As for the existing configs, I agree that since pad_token_id is defaulted to None that they should work without updates.

@github-actions
Copy link
Contributor

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

run-slow: stablelm

@Rocketknight1
Copy link
Member

cc @zucchini-nlp

@zucchini-nlp
Copy link
Member

Thanks for the PR @tobyliu2004 ! I'd prefer to close it in favor of #43592 which is more complete

@tobyliu2004
Copy link
Author

Thanks for reviewing! Makes sense to fix all models at once rather than one by one. Appreciate the feedback!

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.

missing pad_token_idx in StableLmConfig after 5.0 update

4 participants