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 dev dependencies (pytest, grpcio-tools)
pip install -e ".[dev]"

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
  • 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"}'

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.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.0.tar.gz (249.6 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.0-py3-none-any.whl (189.4 kB view details)

Uploaded Python 3

modelexpress-0.5.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (273.4 kB view details)

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

modelexpress-0.5.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (273.9 kB view details)

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

modelexpress-0.5.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (273.3 kB view details)

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

modelexpress-0.5.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (273.8 kB view details)

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

modelexpress-0.5.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (273.3 kB view details)

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

modelexpress-0.5.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (274.0 kB view details)

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

modelexpress-0.5.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (272.4 kB view details)

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

modelexpress-0.5.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (273.0 kB view details)

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

File details

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

File metadata

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

File hashes

Hashes for modelexpress-0.5.0.tar.gz
Algorithm Hash digest
SHA256 d9745ef372905e7930d32a67a4fc360448a32c4f39d9c1f158bd203ffa7faa98
MD5 945e3ca2ca1fc682030ee1f5e1c61e61
BLAKE2b-256 73012d5f646fdf488968765a794cc2af9ee5c35101a02d860070493aafff32d2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for modelexpress-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2535aa8216b6c0d6d50ef1c37d38c57aee172b2572c1c4b67b1a5fc726020b3
MD5 22bcbd758179883eccd95b7880bb307c
BLAKE2b-256 38fc2d9fdcb2317a52c2fcb423147c1dc511f8d6c5c32305c03c52746db7a6f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.5.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e360145952935d5249d81ef33c15475c8d3ed25edb7d26a393994389091ff18e
MD5 0d5ebf8e93ea35fc73dbb94bea275d7e
BLAKE2b-256 54b57f6c77122db87da8c1e0964d3918735e5f83dfa9b0d80403bf7270245eb5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.5.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d565fbe9cb05797a85027b7b038873b8935cb2c7c8a9c2cb833f5f71e4f199d2
MD5 e345cf04303aa094b042198947ca7aa2
BLAKE2b-256 9f0de4579fc5f89a1fb976d454162fa3dd10b46c6ada89cecc58645cc3f5e989

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.5.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0e9c6f3e278619054c97b8929b679699da09f3a555a1502f23d4bf01827e9d1d
MD5 cad9192ebbd1c7ae7aca67427e40ba12
BLAKE2b-256 5141a733b4cdb6e3369ee38c0716fd520304f786804872b6d7db2a8b00b736dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.5.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e8b5cfbd862a967c0cd22526715095da0825b9dbb0c60cd54b628b3c75d6e17f
MD5 452d8fe33a3a67a970217519c658d789
BLAKE2b-256 7c8e7c2c461f61f6762635c790d4997f5fafde2ed4597986e10ad8f073b9375f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.5.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 38bf564d28b7bcaf7bed54cde95f2df24dbe3d5cc76c1a91c60109ff114f6dee
MD5 b52e3def1e81e7225de1438bbd71a28b
BLAKE2b-256 c5a4e3a3ba5f67134fb52005089f565774f787efe459cc2deffa610236928f6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.5.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 88877dc324c45e48b7c1edaa0660c5d6f496c1b10110cc6e20bc8c2d1395b788
MD5 88d8a266cb42d05bb8bc66d61455801c
BLAKE2b-256 306d135789e333782d652e571af86a5c4ec02cc02f6b0542a6142da37b46947b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.5.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8483b2aaf55c07bd93e2f3dca4b8c639d653d23670c4dcc278d7d7cfade4cf1c
MD5 d7a262b87dc7c114c6a975bded378f3d
BLAKE2b-256 cd0ab3ff64a798122603ab643e079167221f7a05caeb1090bb9833690d720842

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.5.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d37f83c83e93bdb1a4ae87d5fc2181da1502f0588f2ab42bbc7ffb0cd18d20dd
MD5 6a97d87b9a123a6080f856be9aafb217
BLAKE2b-256 a10ba200b6ce4b1d4320664b2f6450e216bab7c0720e52d160a57c643799d005

See more details on using hashes here.

Release history Release notifications | RSS feed

0.6.0

10 files

0.5.1

10 files

This release

0.5.0 This release

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