Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix T5 adapter layer input #479

Merged
merged 2 commits into from
Jan 18, 2023
Merged

Conversation

calpt
Copy link
Member

@calpt calpt commented Jan 16, 2023

The adapter implementation of T5 currently passes the inputs to the adapter layer in the wrong order (i.e. residual inputs before hidden states). Thus, the sequential adapter implementation is effectively a parallel adapter.

This PR fixes the inputs order. It also clarifies the adapter layer input parameters.

Clarify adapter layer input parameters.
@@ -340,7 +340,7 @@ def __init__(self, config: T5Config):
def forward(self, hidden_states):
forwarded_states = self.layer_norm(hidden_states)
forwarded_states = self.DenseReluDense(forwarded_states)
hidden_states = self.adapter_layer_forward(hidden_states, self.dropout(forwarded_states), None)
hidden_states = self.adapter_layer_forward(self.dropout(forwarded_states), hidden_states, None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could make it super obvious which one the residual connection is by using hidden_states=..., residual_connection=... in the method call. This could help people adding new models when they have a look at the currently implemented models.

@calpt calpt merged commit dcd9f70 into adapter-hub:master Jan 18, 2023
@calpt calpt deleted the fix/t5-adapter-input branch January 18, 2023 15:39
This pull request was closed.
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.

2 participants