How to set attention mask, any suggestion?
- Vorherrschende Sprache
- Python
- Sterne
- 2.2k
- Forks
- 285
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
As mentioned by `https://github.com/allenai/longformer/issues/75#issuecomment-651295800` , the default is only local attention. So how to generate good global attention? any suggestions about it?
I find a example about it in `README.md`
```
attention_mask = torch.ones(input_ids.shape, dtype=torch.long, device=input_ids.device) # initialize to local attention
attention_mask[:, [1, 4, 21,]] = 2 # Set global attention based on the task. For example,
# classification: the token
# QA: question tokens
```
Why to set `1, 4, 21` global attention ?
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.