Views
No views yet
flash_attention_2 and sdpa support added.auto_map in
config.json points here for the modeling code.transformers.BertModelBertModel (transformers 4.57.6) supports sdpa but not
flash_attention_2. This repo adds a complete attn_implementation dispatch:| Backend | Class | Notes |
|---|---|---|
eager | BertSelfAttention | Standard scaled dot-product, identical to original BERT |
sdpa | BertSdpaSelfAttention | F.scaled_dot_product_attention, bool mask -> additive float mask |
flash_attention_2 | BertFlashSelfAttention | flash_attn_varlen_func for padded inputs, flash_attn_func for unpadded |
| Model | Purpose |
|---|---|
| BERT-updated | Shared BERT runtime |
| MosaicBERT-updated | Shared MosaicBERT runtime |
1from transformers import AutoTokenizer, AutoModel
2
3tokenizer = AutoTokenizer.from_pretrained("Taykhoom/RNABERT", trust_remote_code=True)
4model = AutoModel.from_pretrained("Taykhoom/RNABERT", trust_remote_code=True)
5
6# Flash Attention 2
7model = AutoModel.from_pretrained("Taykhoom/UTRBERT-3mer", trust_remote_code=True,
8 attn_implementation="flash_attention_2")