Skip to main content

ModelExpress Python Client

Python client for ModelExpress -- high-performance GPU-to-GPU model weight transfers using NVIDIA NIXL over RDMA/InfiniBand.

Instead of each inference engine instance loading model weights from storage, one instance loads the model and transfers weights directly to later instances via GPUDirect RDMA, bypassing the CPU entirely.

Installation

# From PyPI (coming soon)
pip install modelexpress

# Editable install from source
pip install -e .

# With test dependencies
pip install -e ".[dev]"

# Additionally install the pinned protobuf code generator when changing p2p.proto
pip install -e ".[codegen]"

NIXL is expected to be supplied by the runtime environment (TRT-LLM, SGLang, Dynamo, and NemoRL runtime images all ship nixl-cu12 or nixl-cu13). For a bare-environment install, run pip install nixl-cu12 or pip install nixl-cu13 separately, matching your host CUDA toolkit.

Requirements

  • Python >= 3.10
  • protobuf >= 5.27.2 and < 7
  • NVIDIA GPUs with RDMA/InfiniBand support
  • NIXL (NVIDIA Interconnect eXchange Library)
  • A running ModelExpress server (Rust gRPC service backed by Redis)

Quick Start with vLLM

vLLM 0.23.0 and newer recognize --load-format modelexpress natively. Install the ModelExpress Python package in the vLLM image; no VLLM_PLUGINS setting or manual loader registration is required. For older vLLM versions, set VLLM_PLUGINS=modelexpress or call register_modelexpress_loaders() manually.

export MX_SERVER_ADDRESS="modelexpress-server:8001"

vllm serve deepseek-ai/DeepSeek-V4-Pro \
    --load-format modelexpress \
    --tensor-parallel-size 8 \
    --trust-remote-code

Starting the vLLM engine with the modelexpress load format on the source worker will load the weights from disk and register/publish the NIXL and tensor metadata to the MX server. The mx load format is kept as a backward-compatible alias. On the target worker, it retrieves metadata from the MX server and streams weights over RDMA from GPU to GPU. Set MX_ARTIFACT_TRANSFER=1 to also reuse compatible vLLM JIT caches from a ready source.

Quick Start with SGLang

SGLang integrates through its remote_instance loader with the modelexpress backend. Use an SGLang image that includes upstream sgl-project/sglang#24723, such as the known-good release image lmsysorg/sglang:v0.5.13.post1, and install the ModelExpress package into that image.

export MX_SERVER_ADDRESS="modelexpress-server:8001"

python -m sglang.launch_server \
    --model-path deepseek-ai/DeepSeek-V3 \
    --tp 8 \
    --load-format remote_instance \
    --remote-instance-weight-loader-backend modelexpress \
    --modelexpress-config '{"transport": "nixl"}'

Quick Start with TensorRT-LLM

TensorRT-LLM integrates through its native checkpoint_format="MX" interface. Install ModelExpress in a qualified TensorRT-LLM image, then construct the PyTorch backend with the ModelExpress server configuration:

from tensorrt_llm.llmapi import LLM

llm = LLM(
    model="/model",
    checkpoint_format="MX",
    mx_config={
        "server_url": "modelexpress-server:8001",
    },
    tensor_parallel_size=4,
    backend="pytorch",
)

The first replica falls back to the Hugging Face checkpoint and publishes its post-transform weights; later compatible replicas receive them through ModelExpress. The current qualified scope is the LlamaForCausalLM family. See the TensorRT-LLM P2P example for the qualified-image requirement and production-style Kubernetes deployment.

Programmatic Usage

MxClient

MxClient is a lightweight gRPC client for communicating with the ModelExpress server:

from modelexpress import MxClient

client = MxClient(server_url="modelexpress-server:8001")

# Query for a source model
response = client.get_metadata("deepseek-ai/DeepSeek-V4-Pro")
if response.found:
    for worker in response.workers:
        print(f"Worker rank {worker.worker_rank}: {len(worker.tensors)} tensors")

# Wait for source readiness (blocks until ready or timeout)
success, session_id, metadata_hash = client.wait_for_ready(
    model_name="deepseek-ai/DeepSeek-V4-Pro",
    worker_id=0,
    timeout_seconds=7200,
)

client.close()

Registering Loaders Manually

Manual registration is only needed for integrations that construct vLLM loaders outside vLLM 0.23.0's native load-format path.

from modelexpress import register_modelexpress_loaders

register_modelexpress_loaders()
# Now vLLM recognizes --load-format modelexpress and mx

Environment Variables

Variable Default Description
MX_SERVER_ADDRESS localhost:8001 ModelExpress gRPC server address (recommended)
MODEL_EXPRESS_URL localhost:8001 Deprecated, pending removal in a future release. Still read by all client paths and takes precedence when both are set; keep setting it during the transition.
MX_DISABLE_PATCHES 0 Emergency escape hatch that skips all runtime compatibility patches. Set to 1, true, yes, or on if a patch is incompatible with the installed engine.
MX_EXPECTED_WORKERS Auto-detected from TP size Number of GPU workers to coordinate
MX_SYNC_PUBLISH 0 Source: wait for all workers before publishing metadata
MX_SYNC_START 1 Target: wait for all source workers before transferring
MX_POOL_REG 0 Allocation-level NIXL registration (registers cudaMalloc blocks instead of individual tensors)
MX_P2P_METADATA 1 Serve tensor and artifact manifests directly from source workers; set to 0 to route full tensor metadata through the central server
MX_ARTIFACT_TRANSFER 0 Transfer compatible vLLM TorchInductor, Triton, DeepGEMM, TileLang, CuTe DSL, and FlashInfer JIT caches, including persistent autotune files when supported by vLLM
MX_ARTIFACT_BUNDLE_ROOT $TMPDIR/modelexpress-artifacts Staging root for tarred cache artifact bundles
MX_ARTIFACT_COMPILE_CONFIG_DIGEST empty Optional compile-configuration compatibility digest for cache discovery
MX_ARTIFACT_READY_URL Framework default Readiness endpoint checked before a source publishes weights or JIT cache artifacts (http://127.0.0.1:8000/health for vLLM; http://127.0.0.1:30000/health for SGLang). On the non-head nodes of a multi-node engine, a loopback host is rewritten onto the head's address (the engine's own distributed-init address, else LWS_LEADER_ADDRESS), preserving the configured port and path. A non-loopback host is used verbatim
MX_ARTIFACT_READY_TIMEOUT_SECS 1800 Maximum time to wait for readiness and successful artifact publication

UCX/NIXL Tuning

Variable Recommended Description
UCX_RNDV_SCHEME get_zcopy Zero-copy RDMA reads
UCX_RNDV_THRESH 0 Force rendezvous for all transfers
NIXL_LOG_LEVEL INFO NIXL logging level

Package Structure

Module Description
modelexpress.client MxClient -- gRPC client for the ModelExpress server
modelexpress.metadata Metadata clients, source identity, publishing, and worker manifest serving
modelexpress.engines.vllm.loader MxModelLoader -- vLLM integration
modelexpress.engines.sglang.loader MxModelLoader -- SGLang remote_instance integration
modelexpress.engines.trtllm.loader MxModelLoader -- TensorRT-LLM shared-strategy integration
modelexpress.vllm_loader Compatibility shim for the vLLM loader
modelexpress.nixl_transfer NixlTransferManager -- NIXL agent lifecycle and RDMA transfers
modelexpress.types TensorDescriptor, WorkerMetadata -- core data types
modelexpress.vllm_worker Compatibility worker extension for older manual-registration workflows

How It Works

  1. Source loads weights from disk, registers raw tensors with NIXL before FP8 processing, and publishes metadata to the ModelExpress server.
  2. Target creates dummy weights, waits for the source ready flag, then pulls raw tensors via RDMA read.
  3. Both source and target run process_weights_after_loading() independently, producing identical FP8-transformed weights.
  4. When artifact transfer is enabled, a healthy source publishes its pod-scoped JIT caches and later pods install compatible caches before model initialization.

This pre-processing transfer strategy is critical for FP8 models (e.g., DeepSeek-V4-Pro) where tensors are renamed and transformed during processing.

License

Apache-2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modelexpress-0.5.1.tar.gz (253.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

modelexpress-0.5.1-py3-none-any.whl (189.8 kB view details)

Uploaded Python 3

modelexpress-0.5.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (273.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

modelexpress-0.5.1-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (274.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

modelexpress-0.5.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (273.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

modelexpress-0.5.1-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (274.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

modelexpress-0.5.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (273.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

modelexpress-0.5.1-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (274.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

modelexpress-0.5.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (272.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

modelexpress-0.5.1-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (273.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

File details

Details for the file modelexpress-0.5.1.tar.gz.

File metadata

  • Download URL: modelexpress-0.5.1.tar.gz
  • Upload date:
  • Size: 253.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for modelexpress-0.5.1.tar.gz
Algorithm Hash digest
SHA256 214cdf251a0a5a5410ef20704e7bdde05c1ede24a45a8ead3125db28e1601c6d
MD5 f2bee0dd33a8a29e8f8e386cd2736166
BLAKE2b-256 e95e4f166a790c133ea09dfc1b1234c199f467bd34be446deee16669a18d3ae9

See more details on using hashes here.

File details

Details for the file modelexpress-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: modelexpress-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 189.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for modelexpress-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8d61cc66b7af2f444e8715406591f383707d00caff2a7a7e08ec247232c4ac9e
MD5 4582ba105fa3d58ee88e6fd0035143bb
BLAKE2b-256 0cad61b69b91b31f780e62bcfefc624f571baea69ca4becabdaff89af3baf040

See more details on using hashes here.

File details

Details for the file modelexpress-0.5.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for modelexpress-0.5.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e42806ffa7753e891534bee484c1fea00278240e023923abd662b2578a958bab
MD5 8904af3c68fade9c08563ac7ec43914c
BLAKE2b-256 349b7a7d80575be66daee67520da48b8f1bea34a17967926c7f637a200c6b04a

See more details on using hashes here.

File details

Details for the file modelexpress-0.5.1-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for modelexpress-0.5.1-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0c85b7aacc5a994369ae7c88773f3cfee186f3ac43dcf9dcb736006475b24df8
MD5 9c8624fdfd9e55dfb2b1dc330a8a0ca7
BLAKE2b-256 637e19b53b4e4df10b81dbb089cbdd69817b8dd49a7b8a00978523458474b01f

See more details on using hashes here.

File details

Details for the file modelexpress-0.5.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for modelexpress-0.5.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7269fb05e2e07b87b776def54032139fd9e371ac3d06d90be26a63116db2de27
MD5 2fa748187b5428013fd449b2730ab25a
BLAKE2b-256 af163af93194e8d9c226b0f74eeb4993e636fd17a992817d1c5cd3a0fbd5528f

See more details on using hashes here.

File details

Details for the file modelexpress-0.5.1-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for modelexpress-0.5.1-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8937249953cf806465e527c98daf6b9da2fdd331f9ec932e0b33249946b6f139
MD5 7d7d5bc28678bbd0506c01bd0a5c6789
BLAKE2b-256 dabc37b320bf707deebec71ab9361764951920ad4d22d09c247548adec26ee5a

See more details on using hashes here.

File details

Details for the file modelexpress-0.5.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for modelexpress-0.5.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 055b398de7e45e665dccf80dec85953ca850377682dd0d8e858f985394c5c548
MD5 6207e228ecf6485a43f63fa7578198e1
BLAKE2b-256 5a31db51b54b5093f0bc3a62474d715d9546bd89d9381fddb072a2a88c4dec77

See more details on using hashes here.

File details

Details for the file modelexpress-0.5.1-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for modelexpress-0.5.1-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 11adf983284f5df7c1b3dc58d4146a1cc83ec4898a75cfbfd1d1341564e01c79
MD5 a60959b9f5b69e3a818f3be13aa95ce2
BLAKE2b-256 e51c6dc0cecd75acc6746bf68637611473c3972319e20a08282e3048164e81ad

See more details on using hashes here.

File details

Details for the file modelexpress-0.5.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for modelexpress-0.5.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 32882c2459659d1e00fa1d339fbd0da56c68fbd916a5ffe45be94a1728a4e992
MD5 73a007f58ca841e3ef1f2048116ec731
BLAKE2b-256 6430dc0574ced2dac82a17d775328fa79e5d3dc4d3bfbbd25ba9bf7d28d8742a

See more details on using hashes here.

File details

Details for the file modelexpress-0.5.1-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for modelexpress-0.5.1-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5ef5731a7e2b5e82b9acb574d9434b75825117d74e8e6c8f7e06792ac7b829ef
MD5 f0808476c1a7410c4d9ccab8355203f9
BLAKE2b-256 f2b528067165e4d2fbce3a55c82b2b1bd61d340d4f79d29cc574ff5cb14f60ba

See more details on using hashes here.

Release history Release notifications | RSS feed

0.6.0

10 files

This release

0.5.1 This release

10 files

0.5.0

10 files

0.4.1

10 files

0.4.0

4 files

0.3.0

1 file

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