Iona is a transformer encoder foundation model for tandem mass spectra (MS/MS). It treats each centroided peak as a token and learns how peaks relate to each other through a per-head attention bias over the signed m/z difference (Δm/z) between every pair of peaks.
mz and intensity arrays, with at most 512
peaks.last_hidden_state).| Size | Hidden size | Layers | Heads | FFN size |
|---|---|---|---|---|
| iona-base-25m | 512 | 8 | 8 | 2048 |
| iona-base-50m (this model) | 640 | 10 | 10 | 2560 |
| iona-base-100m | 800 | 13 | 10 | 3200 |
| iona-base-200m | 1024 | 16 | 16 | 4096 |
| iona-base-400m | 1280 | 20 | 20 | 5120 |
The checkpoint includes its modeling code, so it loads with trust_remote_code=True. You need
torch, transformers, sentence-transformers and pytorch-metric-learning installed.
import torch
from transformers import AutoModelForPreTraining, AutoProcessor
repo = "path/to/iona-base-50m" # this repository's Hub ID, or a local copy
processor = AutoProcessor.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForPreTraining.from_pretrained(repo, trust_remote_code=True).eval()
mz = [175.119, 262.151, 363.198, 476.282]
intensity = [1200.0, 5300.0, 800.0, 2400.0]
inputs = processor(mz, intensity, return_tensors="pt")
with torch.no_grad():
peak_embeddings = model.iona(**inputs).last_hidden_state # (batch, peaks, hidden_size)
The processor normalizes intensities, so pass raw intensity values. For a single embedding per
spectrum, pool peak_embeddings over the peaks where inputs["attention_mask"] is 1.