Skip to content

Conversation

@rebel-thkim
Copy link
Contributor

Pull Request Description

⚠️ Important: Branch Target

  • New features, enhancements, and non-critical fixes: Merge to dev branch
  • Critical hotfixes only: Merge to main branch (must also merge to dev)

Please ensure you've selected the correct base branch before submitting!

Type of Change

  • Release (dev → main merge for production release)
  • New Model Support
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring
  • Other (please describe):

Changes Overview

Motivation and Context

Related Issues


Conventional commit

type(optional scope): description

Type candidate

  • Model Updates
    • model: Adding New models or Bugfix for existing models
      • ex) Add LlavaNext
      • ex) Bugfix Whisper
  • Enhancements
    • performance: Optimizing some models or this library itself
      • ex) Loading RBLNModel faster
      • ex) Optimizing Memory Usage of DecoderOnlyModel
  • Code Refactor
    • refactor: Re-arrange class architecture, or more.
      • ex) Refactor Seq2Seq
  • Documentation
    • doc: Update docstring only
  • Library Dependencies
    • dependency: Update requirements, something like that.
  • Release
    • release: Merging dev to main for production release
      • ex) Release v1.2.0
  • Other
    • other: None of above.
      • ex) ci update
      • ex) pdm update

@rebel-thkim rebel-thkim requested a review from Copilot November 20, 2025 07:59
Copy link
Contributor

Copilot AI left a 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_states parameter 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.

@rebel-kblee
Copy link
Contributor

can you add the test cases with rbln_config.output_hidden_states=True?

@rebel-jongho
Copy link
Collaborator

Can output_hidden_states in configuration_colqwen2.py be removed?

@rebel-thkim
Copy link
Contributor Author

colqwen2 is refactored on the other PR @rebel-jongho

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.

4 participants