def forward(self, hidden_states, layer_past=None, attention_mask=None, head_mask=None, use_cache=False, output_attentions=False):
    residual = hidden_states
    hidden_states = self.ln_1(hidden_states)
    attn_outputs = self.attn(hidden_states, layer_past=layer_past, attention_mask=attention_mask, head_mask=head_mask, use_cache=use_cache, output_attentions=output_attentions)
    attn_output = attn_outputs[0]
    outputs = attn_outputs[1:]
    hidden_states = (attn_output + residual)
    residual = hidden_states
    hidden_states = self.ln_2(hidden_states)
    feed_forward_hidden_states = self.mlp(hidden_states)
    hidden_states = (residual + feed_forward_hidden_states)
    if use_cache:
        outputs = ((hidden_states,) + outputs)
    else:
        outputs = ((hidden_states,) + outputs[1:])
    return outputs
def forward(self, hidden_states, layer_past=None, attention_mask=None, head_mask=None, use_cache=False, output_attentions=False):
    residual = hidden_states
    hidden_states = self.ln_1(hidden_states)
    attn_outputs = self.attn(hidden_states, layer_past=layer_past, attention_mask=attention_mask, head_mask=head_mask, use_cache=use_cache, output_attentions=output_attentions)
    attn_output = attn_outputs[0]
    outputs = attn_outputs[1:]
    hidden_states = (attn_output + residual)
    residual = hidden_states
    hidden_states = self.ln_2(hidden_states)
    feed_forward_hidden_states = self.mlp(hidden_states)
    hidden_states = (residual + feed_forward_hidden_states)
    if use_cache:
        outputs = ((hidden_states,) + outputs)
    else:
        outputs = ((hidden_states,) + outputs[1:])
    return outputs