hxxiang/dna_benchmarks
Preview • Updated • 302 • 1
How to use hxxiang/opticaldna-rice-2048 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("feature-extraction", model="hxxiang/opticaldna-rice-2048", trust_remote_code=True) # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("hxxiang/opticaldna-rice-2048", trust_remote_code=True, device_map="auto")ICML 2026 OpticalDNA checkpoint pretrained on rice NIP-T2T (w2048, o1920, uppercase sequences). Released checkpoint: step 150,000.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "hxxiang/opticaldna-rice-2048"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
torch_dtype="auto",
).cuda().eval()
# Visual features only: the language Decoder is not executed.
features = model.extract_features("page.png", pooling="mean", to_cpu=True)
# Decoder inference: short T1 / Free OCR.
prompt = model.build_prompt("t1_full_ocr", length="short")
text = model.generate_document(
tokenizer,
"page.png",
prompt=prompt,
max_new_tokens=256,
)
# Prompt-conditioned Decoder hidden states.
decoder_features = model.extract_decoder_features(
tokenizer,
"page.png",
prompt=prompt,
pooling="mean",
to_cpu=True,
)
For multi-page input, pass pages in reading order, e.g. ["page1.png", "page2.png"].
Code and environment: OpticalDNA GitHub. Paper: Rethinking Genomic Modeling Through Optical Character Recognition, ICML 2026.