Feature Extraction
Transformers
PyTorch
English
modernbert
genomics
rna
nucleotide
sequence-modeling
biology
bioinformatics
electra
Instructions to use FreakingPotato/RNAElectra with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FreakingPotato/RNAElectra with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="FreakingPotato/RNAElectra")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("FreakingPotato/RNAElectra") model = AutoModel.from_pretrained("FreakingPotato/RNAElectra", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Commit ·
c3eb14b
1
Parent(s): 1735c76
Replace weights with the paper's final model (run 073017)
Browse files- pytorch_model.bin: 30-epoch from-scratch pretraining run reported in the
paper (global attention in every layer), fp32. Replaces the earlier upload
of the windowed local-global ablation variant.
- config.json: matches the training architecture (global_attn_every_n_layers=1,
local_attention=512); token-id fields corrected to match vocab.json.
- tokenizer_config.json: add missing 'k' (from_pretrained crashed without it).
- tokenizer.py: map U->T in _tokenize so RNA-alphabet input tokenizes
correctly (previously produced [UNK]); T-alphabet encoding unchanged.
- README: architecture note and weight-version note.
- README.md +3 -1
- config.json +11 -11
- pytorch_model.bin +2 -2
- tokenizer.py +1 -1
- tokenizer_config.json +1 -0
README.md
CHANGED
|
@@ -24,7 +24,9 @@ RNAElectra is a nucleotide-resolution RNA language model trained using an ELECTR
|
|
| 24 |
- **Training Objective**: ELECTRA-style replaced-token detection
|
| 25 |
- **Resolution**: Single-nucleotide
|
| 26 |
- **Domain**: RNA and transcriptomic sequences
|
| 27 |
-
- **Architecture**: ModernBERT-style backbone adapted for nucleotide sequences
|
|
|
|
|
|
|
| 28 |
|
| 29 |
RNAElectra focuses on efficient pre-training by learning to discriminate corrupted tokens rather than reconstruct them, leading to strong representations with improved training efficiency.
|
| 30 |
|
|
|
|
| 24 |
- **Training Objective**: ELECTRA-style replaced-token detection
|
| 25 |
- **Resolution**: Single-nucleotide
|
| 26 |
- **Domain**: RNA and transcriptomic sequences
|
| 27 |
+
- **Architecture**: ModernBERT-style backbone adapted for nucleotide sequences (22 layers, hidden size 512, 16 heads, global self-attention in every layer)
|
| 28 |
+
|
| 29 |
+
> **Note (2026-08)**: the released weights correspond to the final model reported in the RNAElectra paper (30-epoch pretraining on the RNAcentral-derived corpus, full global attention in every layer). They replace an earlier upload of an ablation variant that used windowed local-global attention.
|
| 30 |
|
| 31 |
RNAElectra focuses on efficient pre-training by learning to discriminate corrupted tokens rather than reconstruct them, leading to strong representations with improved training efficiency.
|
| 32 |
|
config.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
-
"bos_token_id":
|
| 8 |
"classifier_activation": "gelu",
|
| 9 |
"classifier_bias": false,
|
| 10 |
"classifier_dropout": 0.0,
|
|
@@ -12,10 +12,9 @@
|
|
| 12 |
"cls_token_id": 2,
|
| 13 |
"decoder_bias": true,
|
| 14 |
"deterministic_flash_attn": false,
|
| 15 |
-
"dtype": "float32",
|
| 16 |
"embedding_dropout": 0.0,
|
| 17 |
-
"eos_token_id":
|
| 18 |
-
"global_attn_every_n_layers":
|
| 19 |
"global_rope_theta": 10000,
|
| 20 |
"hidden_activation": "gelu",
|
| 21 |
"hidden_size": 512,
|
|
@@ -23,9 +22,9 @@
|
|
| 23 |
"initializer_range": 0.02,
|
| 24 |
"intermediate_size": 2048,
|
| 25 |
"layer_norm_eps": 1e-12,
|
| 26 |
-
"local_attention":
|
| 27 |
"local_rope_theta": 1000,
|
| 28 |
-
"mask_token_id":
|
| 29 |
"max_position_embeddings": 8192,
|
| 30 |
"mlp_bias": false,
|
| 31 |
"mlp_dropout": 0.0,
|
|
@@ -34,13 +33,14 @@
|
|
| 34 |
"norm_eps": 1e-12,
|
| 35 |
"num_attention_heads": 16,
|
| 36 |
"num_hidden_layers": 22,
|
| 37 |
-
"pad_token_id":
|
| 38 |
"repad_logits_with_grad": false,
|
| 39 |
-
"sep_token_id":
|
| 40 |
"sparse_pred_ignore_index": -100,
|
| 41 |
"sparse_prediction": false,
|
| 42 |
"tie_word_embeddings": false,
|
| 43 |
-
"
|
| 44 |
-
"
|
|
|
|
| 45 |
"vocab_size": 27
|
| 46 |
-
}
|
|
|
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 5,
|
| 8 |
"classifier_activation": "gelu",
|
| 9 |
"classifier_bias": false,
|
| 10 |
"classifier_dropout": 0.0,
|
|
|
|
| 12 |
"cls_token_id": 2,
|
| 13 |
"decoder_bias": true,
|
| 14 |
"deterministic_flash_attn": false,
|
|
|
|
| 15 |
"embedding_dropout": 0.0,
|
| 16 |
+
"eos_token_id": 6,
|
| 17 |
+
"global_attn_every_n_layers": 1,
|
| 18 |
"global_rope_theta": 10000,
|
| 19 |
"hidden_activation": "gelu",
|
| 20 |
"hidden_size": 512,
|
|
|
|
| 22 |
"initializer_range": 0.02,
|
| 23 |
"intermediate_size": 2048,
|
| 24 |
"layer_norm_eps": 1e-12,
|
| 25 |
+
"local_attention": 512,
|
| 26 |
"local_rope_theta": 1000,
|
| 27 |
+
"mask_token_id": 4,
|
| 28 |
"max_position_embeddings": 8192,
|
| 29 |
"mlp_bias": false,
|
| 30 |
"mlp_dropout": 0.0,
|
|
|
|
| 33 |
"norm_eps": 1e-12,
|
| 34 |
"num_attention_heads": 16,
|
| 35 |
"num_hidden_layers": 22,
|
| 36 |
+
"pad_token_id": 0,
|
| 37 |
"repad_logits_with_grad": false,
|
| 38 |
+
"sep_token_id": 3,
|
| 39 |
"sparse_pred_ignore_index": -100,
|
| 40 |
"sparse_prediction": false,
|
| 41 |
"tie_word_embeddings": false,
|
| 42 |
+
"torch_dtype": "float32",
|
| 43 |
+
"transformers_version": "4.48.2",
|
| 44 |
+
"unknown_token_id": 1,
|
| 45 |
"vocab_size": 27
|
| 46 |
+
}
|
pytorch_model.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1a969702e2fa804ade947ab3c221030653a0accbf7a9d1bec72585a9a0bf44e4
|
| 3 |
+
size 369288059
|
tokenizer.py
CHANGED
|
@@ -110,7 +110,7 @@ class NucEL_Tokenizer(PreTrainedTokenizer):
|
|
| 110 |
Returns:
|
| 111 |
List of tokens.
|
| 112 |
"""
|
| 113 |
-
text = text.upper().strip()
|
| 114 |
tokens = [self.cls_token]
|
| 115 |
i = 0
|
| 116 |
|
|
|
|
| 110 |
Returns:
|
| 111 |
List of tokens.
|
| 112 |
"""
|
| 113 |
+
text = text.upper().strip().replace('U', 'T') # RNA U -> T (paper: {A,C,G,U} mapped to {A,C,G,T})
|
| 114 |
tokens = [self.cls_token]
|
| 115 |
i = 0
|
| 116 |
|
tokenizer_config.json
CHANGED
|
@@ -62,6 +62,7 @@
|
|
| 62 |
"cls_token": "[CLS]",
|
| 63 |
"eos_token": "[EOS]",
|
| 64 |
"extra_special_tokens": {},
|
|
|
|
| 65 |
"mask_token": "[MASK]",
|
| 66 |
"model_max_length": 1025,
|
| 67 |
"pad_token": "[PAD]",
|
|
|
|
| 62 |
"cls_token": "[CLS]",
|
| 63 |
"eos_token": "[EOS]",
|
| 64 |
"extra_special_tokens": {},
|
| 65 |
+
"k": 1,
|
| 66 |
"mask_token": "[MASK]",
|
| 67 |
"model_max_length": 1025,
|
| 68 |
"pad_token": "[PAD]",
|