Skip to main content

linml (Python Bindings)

PyPI License: MIT

Python client library and CLI wrapper for LinML (Linux ML), the Linux counterpart to Windows ML for ONNX Runtime.

Features

  • Direct In-Memory Inference Sessions: linml.InferenceSession("model.onnx") executes ONNX models with hardware-abstracted execution providers (cpu, cuda, tensorrt, trt-rtx, openvino, migraphx).
  • HTTP REST Microservice Client: linml.InferenceClient("http://localhost:8080") interacts with high-performance linml serve daemons at ~1 ms latency.
  • NumPy Integration: Pass numpy arrays directly as dictionary kwargs or lists; outputs convert seamlessly back to NumPy ndarray.
  • Model Graph & EP Diagnostics: linml.inspect("model.onnx") inspects model graph topology, dynamic shapes, and execution provider compatibility warnings.
  • Hardware Probing & Auto-Setup: linml.setup() and linml.doctor() discover and verify host accelerators directly from Python.

Quick Start

1. Installation

pip install linml

2. High-Level Inference Session

import numpy as np
import linml

# Launch an in-process or daemon-managed session
with linml.InferenceSession("model.onnx", provider="cuda") as session:
    x = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]], dtype=np.float32)
    result = session.predict(x=x)
    
    print(f"Provider: {result.selected_provider}")
    print(f"Latency:  {result.latency_ms:.2f} ms")
    
    # Access output tensor as NumPy array
    y = result.outputs["y"].to_numpy()
    print("Output shape:", y.shape)

3. HTTP Microservice Client (linml serve)

When running linml serve --port 8080 --model model.onnx:

import linml

client = linml.InferenceClient("http://localhost:8080")

# Check service health and provider readiness
health = client.health()
print(f"Status: {health.status}, Provider: {health.selected_provider}")

# Submit prediction
result = client.predict({"x": [[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]})
print(result.outputs["y"].data)

client.close()

4. Model Inspection & Diagnostics

import linml

# Inspect model inputs, outputs, opset, and EP compatibility
report = linml.inspect("model.onnx")

print(f"Format: ONNX IR v{report.ir_version}, Opset: {report.opsets}")
for inp in report.inputs:
    print(f"Input: {inp.name} ({inp.data_type}, shape={inp.shape})")

for warning in report.compatibility_warnings:
    print(f"Warning [{warning.provider}]: {warning.message}")

License

MIT License. See LICENSE for details.

Metadata

Release files for linml 0.6.2

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

Source distribution (sdist)

Source distribution for linml 0.6.2
File Size Uploaded Provenance Actions
linml-0.6.2.tar.gz 17.1 kB With provenance Details for linml-0.6.2.tar.gz

Built distribution (wheel)

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

Total release size: 31.3 kB

Release files / linml-0.6.2.tar.gz

Download URL linml-0.6.2.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bc9323135529564a758616d0dc116a8aaf5d9224c4e438e3f7c4138064a98da8
BLAKE2b-256 checksum
How to use checksums
6c26a6235530c1facd290987fb80236319350685b88d0e9a7cc6a53180dd6dd5
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 29, 2026.

Transparency log

Release files / linml-0.6.2-py3-none-any.whl

Download URL linml-0.6.2-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91bfa7187defaaeb313417ecbf377ccedcfdb1361beed55c674580388985a425
BLAKE2b-256 checksum
How to use checksums
49a4cb5ea33473218ef0257bef6b8b30ae5b575c94fdceb86a627060692db0da
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 29, 2026.

Transparency log

Security for linml 0.6.2

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 linml-0.6.2.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 29, 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.6.2 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