LbsTempest commited on
Commit
df25cfa
·
verified ·
1 Parent(s): 200e3ef

Fix: Correct hidden state return value in forward method

Browse files

### 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.

Files changed (1) hide show
  1. modeling.py +1 -1
modeling.py CHANGED
@@ -643,7 +643,7 @@ class Fast_dLLM_QwenForCausalLM(Fast_dLLM_QwenPreTrainedModel, GenerationMixin):
643
  loss=loss,
644
  logits=logits,
645
  past_key_values=outputs.past_key_values,
646
- hidden_states=outputs.hidden_states,
647
  attentions=outputs.attentions,
648
  block_past_key_values=outputs.block_past_key_values,
649
  )
 
643
  loss=loss,
644
  logits=logits,
645
  past_key_values=outputs.past_key_values,
646
+ hidden_states=outputs.last_hidden_state,
647
  attentions=outputs.attentions,
648
  block_past_key_values=outputs.block_past_key_values,
649
  )