"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "81c8191b4651de216c00e25e1af607683e980614"
Unverified Commit 77c3973e authored by Younes Belkada's avatar Younes Belkada Committed by GitHub
Browse files

[`Pix2Struct`] Fix pix2struct cross attention (#25200)

* fix pix2struct cross attention

* fix torchscript slow test
parent 4033ea71
...@@ -1547,8 +1547,9 @@ class Pix2StructTextModel(Pix2StructPreTrainedModel): ...@@ -1547,8 +1547,9 @@ class Pix2StructTextModel(Pix2StructPreTrainedModel):
present_key_value_states = present_key_value_states + (present_key_value_state,) present_key_value_states = present_key_value_states + (present_key_value_state,)
if output_attentions: if output_attentions:
all_attentions = all_attentions + (layer_outputs[2],) all_attentions = all_attentions + (layer_outputs[3],)
all_cross_attentions = all_cross_attentions + (layer_outputs[3],) if encoder_hidden_states is not None:
all_cross_attentions = all_cross_attentions + (layer_outputs[5],)
hidden_states = self.final_layer_norm(hidden_states) hidden_states = self.final_layer_norm(hidden_states)
hidden_states = self.dropout(hidden_states) hidden_states = self.dropout(hidden_states)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment