-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bart] Move CLS rep extraction from EOS tokens to head classes (#624)
Fixes #494 and fixes #563. `BartAdapterModel` currently tries to extract CLS token representations from EOS tokens independent from the used heads (if at all). This causes weird issues for models not using CLS token based heads. This PR moves CLS token rep extraction into the specific head classes to only compute it when needed. Two (re-usable) new args to `forward_head()` are introduced: - `get_cls_from_eos_tokens`: to indicate a model uses CLS reps from EOS tokens - `eos_mask`: token mask to extract CLS reps (required when passing `get_cls_from_eos_tokens=True`)
- Loading branch information
Showing
2 changed files
with
34 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters