Fix: Correct hidden state return value in forward method

#3
by LbsTempest - opened

Problem

The forward method in modeling.py line 646 incorrectly assigns outputs.hidden_states to the hidden_states field in its return object.

The correct tensor, outputs.last_hidden_state, is already computed and used internally to calculate the logits, but it is effectively discarded in the final return value.

Solution

This commit corrects a single variable in the return statement. It changes outputs.hidden_states to outputs.last_hidden_state, ensuring the final hidden state tensor is correctly passed through.

This makes the model's output useful for feature extraction and analysis, fixing the intended behavior without any other functional changes.

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment