Skip to main content

espaloma-onnx

CPU inference for Espaloma 0.3.2: RDKit/NumPy preprocessing and a dynamic FP32 ONNX model. MIT licensed. Copyright (c) 2026 Xiaoxuan Yu, Peking University; upstream attribution is retained in LICENSE and NOTICE.

Install and run

uv sync --locked
uv run espaloma-onnx CCO --model /path/to/model-directory
ESPALOMA_ONNX_MODEL=/path/to/model-directory uv run pytest -q
uv build
from espaloma_onnx import Predictor
predict = Predictor.from_pretrained("/path/to/model-directory", threads=8)
result = predict("CCO")
print(result.parameters["n1_q"])
print(result.indices["indices_2"])

Optional download integrations: uv sync --extra hf or uv sync --extra modelscope; load Predictor.from_pretrained("youmans/espaloma-onnx", source="huggingface", revision="version-tag") (or source="modelscope"). Remote models must exist at the selected revision. Local paths work without either SDK.

Layout

  • src/espaloma_onnx/: installable runtime package and CLI
  • tests/: portable original-DGL reference fixtures and regression tests
  • model-metadata/: model configuration, license and upstream provenance
  • docs/model-card.md: model card used for both model hubs
  • .artifacts/: generated model assets (excluded from Git)
  • benchmarks/: comparison tools and raw reports in results/
  • scripts/: explicit-path export and platform publishing utilities
  • docs/: export, comparison results and release setup
  • pyproject.toml / uv.lock: runtime, development and optional download dependencies
  • pixi.toml / pixi.lock: upstream export-only environment

Comparison results

Ryzen 9 9950X3D, cyclosporin A (196 atoms including H), 10 warmups and 100 forwards:

Runtime Threads Median P95
DGL baseline 8 23.61 ms 26.86 ms
ONNX Runtime CPU 8 11.81 ms 15.75 ms
ONNX Runtime CPU 16 12.50 ms 13.41 ms

This table measures model execution with prepared graph inputs. Full SMILES request and startup measurements are reported below. Raw results include DGL, Tensor, compiled PyTorch and ONNX experiments; the model card documents the model interface. Portable tests cover 116 original-DGL reference cases with exact input equality and output rtol=1e-4/atol=1e-5; 2 H2 cases fail original graph construction. Numerical consistency is not scientific force-field accuracy validation.

First result and request latency

Ryzen 9 9950X3D, 8 CPU threads, local model files:

User operation Caffeine median / P95 Cyclosporin A median / P95
Start a Python process and receive the first result 140.23 / 209.98 ms 155.20 / 157.14 ms
Initialize Predictor (runtime import, file verification and session creation) 47.87 / 56.10 ms 47.02 / 48.41 ms
First SMILES request after Predictor initialization 6.57 / 7.33 ms 21.66 / 24.18 ms
Subsequent SMILES requests on a resident Predictor 3.01 / 3.71 ms 15.41 / 19.26 ms

SMILES request timing covers molecular preprocessing, ONNX execution and result assembly. Process-to-first-result timing additionally covers Python startup, package imports and Predictor initialization. Each molecule was measured in 10 fresh subprocesses using local files with normal OS filesystem caching; each subprocess then performed 10 warmups and 100 requests (1,000 resident requests per molecule). Model download is a separate installation step. The rows measure different scopes; their medians are not additive.

Reproduce with uv run python benchmarks/first_request.py --model /path/to/model --trials 10 --threads 8.

Reuse a Predictor for interactive applications and services. For command-line usage, the process-to-first-result row represents the initial wait most directly. Raw samples include per-process startup stages and request timings.

Full-request comparison: original DGL and ONNX

Same Ryzen 9 9950X3D, 8 CPU threads and Python interpreter, 10 fresh processes per molecule/backend. Each process performs one first request, 10 warmups and 100 subsequent requests. Local model files use normal OS caching. A request starts from SMILES and returns parameter arrays; DGL builds the original OpenFF/DGL graph on each request, while ONNX builds the seven RDKit/NumPy inputs. Model loading includes file checksum verification in both paths. Source model runtime is PyTorch 2.1.2/DGL 2.1.0+cu121 on CPU; ORT is 1.20.1. Preprocessing and framework imports are part of each API path.

Molecule / operation DGL median / P95 ONNX median / P95
Caffeine: process start to first result 1298.83 / 1813.03 ms 114.76 / 121.06 ms
Caffeine: first SMILES request after loading 26.08 / 37.34 ms 6.52 / 7.12 ms
Caffeine: subsequent SMILES request 15.61 / 21.74 ms 2.89 / 3.27 ms
Cyclosporin A: process start to first result 1772.10 / 1819.01 ms 128.38 / 132.49 ms
Cyclosporin A: first SMILES request after loading 489.94 / 511.05 ms 22.89 / 27.32 ms
Cyclosporin A: subsequent SMILES request 391.11 / 486.25 ms 15.22 / 19.94 ms

For cyclosporin A, the full-request median is 25.7x faster on the independent ONNX path; process-to-first-result is 13.8x faster. This comparison measures the whole API, including the replacement of original graph preparation, rather than just the inference engine. Applications that cache original DGL graphs should use the prepared-input forward results above when estimating their benefit.

Reproduce with an upstream export environment and its Python interpreter: python benchmarks/compare_request.py --checkpoint /path/to/espaloma-0.3.2.pt --model /path/to/onnx-directory --trials 10. The interpreter must provide upstream Espaloma and the runtime package source is resolved from this checkout. Run with the export environment activated so its AmberTools binaries are selected. Full raw samples.

Export instructions · Release automation

One molecule per call; dense O(N²) adjacency, original duplicated interaction conventions and native units. The package predicts parameters, not energies, forces or complete simulation systems. See the model card before downstream integration.

Metadata

Release files for espaloma-onnx 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 espaloma-onnx 0.1.0
File Size Uploaded Provenance Actions
espaloma_onnx-0.1.0.tar.gz 50.1 kB With provenance Details for espaloma_onnx-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 59.6 kB

Release files / espaloma_onnx-0.1.0.tar.gz

Download URL espaloma_onnx-0.1.0.tar.gz
Size 50.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8d42bbe9bf068aae70310d295108f2027c37981f376f7b05aee37c82e619880d
BLAKE2b-256 checksum
How to use checksums
a3dce90048b5e38eabf203c13011da2d465cdda2cfcd13f2766386c5ae3f0e94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 16, 2026.

Transparency log

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

Download URL espaloma_onnx-0.1.0-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
295b66102788fb7afdf232b58250768a73ceab3a6b69f115e6f6255dfb0ec17b
BLAKE2b-256 checksum
How to use checksums
d6fa3a9c26204e782337437dbd587f70e16898c12f81057558344ba1ba503b03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 16, 2026.

Transparency log

Security for espaloma-onnx 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for espaloma_onnx-0.1.0.tar.gz

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 Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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