Skip to main content

UltraMS

Encode an MS/MS spectrum in three lines. Fine-tune the same encoder with your own labels.

pip install "ultrams[hub]"
from ultrams import UltraMS

model = UltraMS.from_hub("dsadd4/UltraMS-RT-only")
embedding = model.encode(
    mz=[100.1, 121.1, 150.0], intensity=[20, 100, 35], precursor_mz=301.2
).embedding  # NumPy vector

Fine-tune

encode_tensor keeps gradients. Add a task head and train the encoder and head together:

import torch
from ultrams import UltraMS

model = UltraMS.from_hub("dsadd4/UltraMS-RT-only").train()
head = torch.nn.Linear(model.embedding_dim, 1)
optimizer = torch.optim.AdamW([*model.parameters(), *head.parameters()], lr=1e-5)

for mz, intensity, precursor_mz, target in training_rows:
    prediction = head(model.encode_tensor(mz, intensity, precursor_mz=precursor_mz))
    loss = torch.nn.functional.mse_loss(prediction.flatten(), torch.tensor([target], dtype=torch.float32))
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()

training_rows contains your labelled spectra. For MoNA or UltraAtlas fine-tuning, replace the model ID in the same code.

Checkpoints

Model Hugging Face Use
RT-only D11 UltraMS-RT-only General MS/MS representation
MoNA contrastive UltraMS-MoNA MoNA spectrum similarity
UltraAtlas contrastive UltraMS-UltraAtlas Figure 5 Atlas application

All three can also be loaded from a downloaded model.pt with UltraMS.from_checkpoint(path).

The current pure Ae3 pretraining and RT/ion-mode adaptation source is in training/.

Metadata

Release files for ultrams 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ultrams 0.1.0
File Size Uploaded
ultrams-0.1.0.tar.gz 12.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ultrams 0.1.0
File Interpreter ABI Platform
ultrams-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.4 kB

Release files / ultrams-0.1.0.tar.gz

Download URL ultrams-0.1.0.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
97b853626f378454f8b983dfdde5859da6c76abc3972d3b21816551f64dbac08
BLAKE2b-256 checksum
How to use checksums
427872cdcdb0a653d26d04f27e223ad3349eee7857fee831a65a4cfe29bf5972
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / ultrams-0.1.0-py3-none-any.whl

Download URL ultrams-0.1.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3925027940fa329c64e310b309959cf5a67060173cfaa14434eef6ad13f7889b
BLAKE2b-256 checksum
How to use checksums
bd114b8715418534a338e677846bbed63018bc7972751c663ff2fcc4ea4a9855
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page