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

Add ForwardContext to wrap model forward pass #267

Merged
merged 4 commits into from
Feb 2, 2022

Conversation

calpt
Copy link
Member

@calpt calpt commented Jan 6, 2022

Depends on #257, depends on #263


This PR adds a new ForwardContext class which provides a thread-local context to the forward pass of a model. This context can be used to store information relevant to the current forward pass without the need to add new parameters to the method definitions.

The context should be added to all adapter-supporting models by decorating the respective base model forward() methods with @ForwardContext.wrap.

This functionality is mainly for future use. Currently, it only replaces the pre_transformer_forward() method.

@adapter-hub-bert
Copy link
Member

This PR/issue depends on:


Automatically provided by Dependent Issues (🤖).

@calpt calpt merged commit 2472ccc into adapter-hub:develop Feb 2, 2022
@calpt calpt deleted the dev/forward_context branch February 2, 2022 19:26
calpt added a commit that referenced this pull request Feb 9, 2022
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.

3 participants