-
Notifications
You must be signed in to change notification settings - Fork 3
model: support output hidden states for DecoderOnly #366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for outputting hidden states in DecoderOnly models. The implementation enables models to optionally return intermediate layer representations alongside their standard outputs.
Key changes:
- Added
output_hidden_statesparameter to model configurations and forward methods - Implemented hidden states collection during both prefill and decode phases
- Updated output structures to include hidden states when requested
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/optimum/rbln/transformers/modeling_outputs.py | Added hidden_states field to RBLNDecoderOnlyOutput |
| src/optimum/rbln/transformers/models/decoderonly/configuration_decoderonly.py | Added output_hidden_states configuration parameter |
| src/optimum/rbln/transformers/models/decoderonly/decoderonly_architecture.py | Modified forward methods to collect and return hidden states from all layers |
| src/optimum/rbln/transformers/models/decoderonly/decoderonly_runtime_utils.py | Updated prefill and decode forward methods to handle hidden states output |
| src/optimum/rbln/transformers/models/decoderonly/modeling_decoderonly.py | Added hidden states collection logic for both prefill and decode phases |
| src/optimum/rbln/transformers/models/gemma3/modeling_gemma3.py | Extended Gemma3 model to support hidden states output |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/optimum/rbln/transformers/models/decoderonly/decoderonly_architecture.py
Show resolved
Hide resolved
src/optimum/rbln/transformers/models/decoderonly/decoderonly_architecture.py
Show resolved
Hide resolved
src/optimum/rbln/transformers/models/decoderonly/decoderonly_runtime_utils.py
Show resolved
Hide resolved
src/optimum/rbln/transformers/models/decoderonly/modeling_decoderonly.py
Outdated
Show resolved
Hide resolved
src/optimum/rbln/transformers/models/decoderonly/modeling_decoderonly.py
Outdated
Show resolved
Hide resolved
src/optimum/rbln/transformers/models/decoderonly/modeling_decoderonly.py
Outdated
Show resolved
Hide resolved
|
can you add the test cases with |
|
Can |
|
colqwen2 is refactored on the other PR @rebel-jongho |
Pull Request Description
Type of Change
Changes Overview
Motivation and Context
Related Issues
Conventional commit
Type candidate
model: Adding New models or Bugfix for existing modelsperformance: Optimizing some models or this library itselfrefactor: Re-arrange class architecture, or more.doc: Update docstring onlydependency: Update requirements, something like that.release: Merging dev to main for production releaseother: None of above.