Skip to content

Refactor RemBERT to use output tracing decorators#44085

Open
Zephyr-Blessed wants to merge 1 commit intohuggingface:mainfrom
Zephyr-Blessed:refactor/rembert-output-tracing
Open

Refactor RemBERT to use output tracing decorators#44085
Zephyr-Blessed wants to merge 1 commit intohuggingface:mainfrom
Zephyr-Blessed:refactor/rembert-output-tracing

Conversation

@Zephyr-Blessed
Copy link
Copy Markdown

What does this PR do?

Refactors the RemBERT model to use the new output tracing decorators (@capture_outputs and @can_return_tuple), replacing manual output collection boilerplate.

Changes:

  • Added @capture_outputs decorator to RemBertModel.forward()
  • Added @can_return_tuple decorator to all wrapper model forwards (ForMaskedLM, ForCausalLM, ForSequenceClassification, ForMultipleChoice, ForTokenClassification, ForQuestionAnswering)
  • Added _can_record_outputs mapping on RemBertPreTrainedModel for hidden_states (RemBertLayer) and attentions (RemBertSelfAttention)
  • Removed output_attentions, output_hidden_states, and return_dict parameters from forward signatures
  • Simplified RemBertEncoder loop (removed manual collection of hidden states/attentions)
  • Simplified RemBertLayer and RemBertAttention forward returns to scalar outputs
  • Added **kwargs passthrough for output tracing

Follows the same pattern as the BERT refactor.

Closes #43979

@github-actions
Copy link
Copy Markdown
Contributor

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

run-slow: gptj

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.

Call to contributions: refactor output tracing in transformers

1 participant