Views
No views yet
| Parameter | Value |
|---|---|
| Parameters | 136,120,832 (136.1M) |
| Layers | 22 |
| Attention heads | 12 |
| Embedding dimension | 768 |
| FFN hidden dimension | 1152 (GeGLU; 2304-wide input/gate projection) |
| Vocabulary size | 32768 model rows; 32000 tokenizer entries |
| Positional encoding | RoPE (global and local theta=10000) |
| Normalization | Bias-free LayerNorm (epsilon=1e-5) |
| Architecture | Pre-norm ModernBERT encoder with hybrid local/global attention |
| Local attention window | 128 |
| Global attention | Every 3 layers, starting at layer 0 |
| Max sequence length | 1024 |
[UNK], [CLS], [SEP], [PAD], [MASK], and -.
The model reserves 32,768 embedding/output rows.[-16 kbp, +8 kbp]), with overlapping intervals merged.AIRI-Institute/moderngena-base/model.safetensors.| Model | Parameters | Notes |
|---|---|---|
| ModernGENA-base | 136.1M | This model |
| ModernGENA-large | 377.8M | Larger variant |
1import torch
2from transformers import AutoModel, AutoTokenizer
3
4repo_id = "Taykhoom/ModernGENA-base"
5tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
6model = AutoModel.from_pretrained(
7 repo_id,
8 trust_remote_code=True,
9 attn_implementation="sdpa",
10).eval()
11
12sequences = ["ATCGATCGATCG", "GCTAGCTA"]
13encoded = tokenizer(sequences, return_tensors="pt", padding=True)
14
15with torch.no_grad():
16 output = model(**encoded, output_hidden_states=True)
17
18token_embeddings = output.last_hidden_state # (batch, seq_len, 768)
19cls_embeddings = output.last_hidden_state[:, 0] # (batch, 768)
20layer_12 = output.hidden_states[12]encoded["attention_mask"]. The
hidden_states tuple contains the embedding output and each block output;
last_hidden_state additionally applies the model's final LayerNorm.1import torch
2from transformers import AutoModelForMaskedLM, AutoTokenizer
3
4repo_id = "Taykhoom/ModernGENA-base"
5tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
6model = AutoModelForMaskedLM.from_pretrained(
7 repo_id,
8 trust_remote_code=True,
9 attn_implementation="sdpa",
10).eval()
11
12encoded = tokenizer(["ATCGATCG"], return_tensors="pt")
13encoded["input_ids"][0, 2] = tokenizer.mask_token_id
14with torch.no_grad():
15 logits = model(**encoded).logits # (1, seq_len, 32768)1import torch
2from transformers import AutoModel
3
4repo_id = "Taykhoom/ModernGENA-base"
5
6# PyTorch SDPA (recommended general-purpose backend).
7model = AutoModel.from_pretrained(
8 repo_id,
9 trust_remote_code=True,
10 attn_implementation="sdpa",
11)
12
13# Flash Attention 2 (requires flash-attn and an Ampere-or-newer CUDA GPU).
14model = AutoModel.from_pretrained(
15 repo_id,
16 trust_remote_code=True,
17 attn_implementation="flash_attention_2",
18 dtype=torch.bfloat16,
19)attn_implementation="eager" when attention probabilities are needed.
In transformers 4.57.6, SDPA falls back to eager for
output_attentions=True; Flash Attention 2 does not and returns an empty
attention tuple.AutoModel, or
load AutoModelForSequenceClassification and fine-tune the newly initialized
classification head with the backbone. For sequence-level tasks, use
attention-mask-aware mean pooling or the [CLS] representation.ModernGenaForMaskedLM uses the standard ModernBERT backbone and MLM head
with a narrow Flash Attention 2 compatibility shim. When the MLM model
requests hidden states, the shim keeps the unpadded final representation
token-major until the MLM head has run, then uses ModernBERT's standard
repadding. Eager, SDPA, Flash, hidden-state, logits, and loss numerics are
otherwise unchanged. Load with trust_remote_code=True to enable this class.N characters with the isolated - token, applies BPE, and wraps each
sequence with [CLS] and [SEP]; it does not uppercase input. AIRI's config
retains unused ModernBERT defaults bos_token_id=50281,
eos_token_id=50282, and position_embedding_type="absolute". Encoding
actually uses tokenizer IDs 1/2 for [CLS]/[SEP] and RoPE positions.
These inert AIRI fields are preserved unchanged.1@article{aspidova2026_moderngena,
2 title = {Back to {BERT} in 2026: {ModernGENA} as a Strong, Efficient Baseline for {DNA} Foundation Models},
3 author = {Aspidova, Alena and Kuratov, Yuri and Shadskiy, Artem and Burtsev, Mikhail and Fishman, Veniamin},
4 journal = {bioRxiv},
5 year = {2026},
6 doi = {10.64898/2026.04.21.719816}
7}