Views
No views yet
A, C, G, T.
Output: Logits/Probabilities for the next token in the sequence.nanoGPT recipe.| Dataset | Metric | DNAGPT2_32 | Benchmark (gzip -9) | Benchmark (Jarvis3) |
|---|---|---|---|---|
| Homo sapiens (T2T-CHM13v2.0) | bits/symbol | 1.470 | 2.022 | 1.384 |
| M. llanfair... (Bacteria) | bits/symbol | 1.783 | 2.142 | 1.713 |
| A. thaliana (Plant - Chr1) | bits/symbol | 1.876 | 2.161 | 1.702 |
DNAGPT2_32 model outperforms general-purpose compressors (gzip) and competitive deep learning models like hyenaDNA and megaDNA on the evaluated datasets.transformers library.1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4# Select the model variant (e.g., vocab size 128 or 32 or 1024)
5# Replace with the specific repository path if hosted on HF Hub
6hf_model_repository = "vojtam/DNAGPT2_1024"
7
8device = "cuda" if torch.cuda.is_available() else "cpu"
9
10# Load model and tokenizer
11model = AutoModelForCausalLM.from_pretrained(
12 hf_model_repository,
13 trust_remote_code=True
14).to(device)
15
16tokenizer = AutoTokenizer.from_pretrained(
17 hf_model_repository,
18 trust_remote_code=True
19)
20
21# Inference Example
22dna_sequence = "ACGTTGCAAACG"
23token_ids = tokenizer.encode(dna_sequence, return_tensors="pt").to(device)
24
25with torch.no_grad():
26 logits = model(token_ids).logits
27
28print(f"Input: {dna_sequence}")
29print(f"Logits shape: {logits.shape}")