Skip to main content

Python client for ModelExpress P2P GPU transfer service

Project description

ModelExpress Python Client

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

Instead of each vLLM instance loading model weights from storage, one "source" instance loads the model and transfers weights directly to "target" 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

ModelExpress integrates with vLLM via custom model loaders. vLLM can discover the package through its vllm.general_plugins entrypoint; set VLLM_PLUGINS=modelexpress if your vLLM deployment requires explicit plugin selection. For manual registration, call register_modelexpress_loaders() in your code.

export MX_SERVER_ADDRESS="modelexpress-server:8001"

vllm serve deepseek-ai/DeepSeek-V3 \
    --load-format modelexpress \
    --tensor-parallel-size 8

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. And on the target worker, it will retrieve these metadata from MX serverand stream weights over RDMA from GPU to GPU.

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-V3")
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-V3",
    worker_id=0,
    timeout_seconds=7200,
)

client.close()

Registering Loaders Manually

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_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)

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, heartbeat, and worker manifest serving
modelexpress.engines.vllm.loader MxModelLoader -- vLLM 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.

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

License

Apache-2.0

Project details


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.4.1.tar.gz (136.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.4.1-py3-none-any.whl (116.3 kB view details)

Uploaded Python 3

modelexpress-0.4.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (199.6 kB view details)

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

modelexpress-0.4.1-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (200.1 kB view details)

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

modelexpress-0.4.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (199.5 kB view details)

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

modelexpress-0.4.1-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (200.0 kB view details)

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

modelexpress-0.4.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (199.5 kB view details)

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

modelexpress-0.4.1-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (200.2 kB view details)

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

modelexpress-0.4.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (198.6 kB view details)

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

modelexpress-0.4.1-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (199.2 kB view details)

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

File details

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

File metadata

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

File hashes

Hashes for modelexpress-0.4.1.tar.gz
Algorithm Hash digest
SHA256 2cdcfe0513f67b500b1b90c8d66527b8f22b1a9744591b5111aa7506cd324eff
MD5 c0a36a8ed23352d7ec458c30ea89f98a
BLAKE2b-256 75302e3ff44a1e39743828b9daff3a1069903cc5a20a5c049c043c0ff3a9c756

See more details on using hashes here.

File details

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

File metadata

  • Download URL: modelexpress-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 116.3 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.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dad2601215ba90c5d086537dea3bec05d22f690d334b252c73fab4706d50e6ef
MD5 170e5d90509373eaa209f02b2e37ef3c
BLAKE2b-256 48e1fa1096eb61af13e4919a4dc115cf902fefb62559d6324040c2240e1890c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.4.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cbad6bf77a246a16e411c51c7415c6e70cc52c9ce8cc06e769365f54b9a5c511
MD5 dc7a2f163ac269a7a488e0e9815e68a4
BLAKE2b-256 baab6f8d6ee921e139e60e265c04fa5097e95411937d05fa9ca7d4ebcba8b13b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.4.1-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bd275c02e2ab013ca59f761d75d68ea0062fadb738ba6a676d1d7d80e03df27a
MD5 26f1bca17caec6f2bfd3025a19e23892
BLAKE2b-256 f5748da142dbd84fa5d8310262587e170189651670aa8f73877d9b8430b29d4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.4.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 afecc3a7df2aa1ec11c9433edfe148345f91699572b5f14b0f5cb853d87b9dc5
MD5 1eedb4dead833687f8cc5883469c9c29
BLAKE2b-256 94a1f843f17c58d3498249892ca8478b4bf0d2d1e03483396a202654b7325b1c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.4.1-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1154da40059ef91dc7b65db09ae378b7cf9f1acf7d7b6120f4aeec684b196b78
MD5 46ee6e378f535ccc8ded0e67e13ddb1b
BLAKE2b-256 084fab027b70322ac049df93908571eecb17227496077bd2053b927bb64a5485

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.4.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0aac6689864326fa162a3abf9937eec9c226dac259b48ce7db07b86b72b2c820
MD5 aa286b9ec5f78d4c368431f98b301a69
BLAKE2b-256 5fa09787dddc7c5dbec0981cc938ef4a548781e1b8de2334f0191f99d6c0de72

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.4.1-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 730435c1a8dc2cfe2367fce9518127de42acf8988d3784ff09133dc3b69ac742
MD5 221cd1bbff897a44537fd02cbb760ecb
BLAKE2b-256 3e6e7414b564af897633682b8ba8c9dc3ac70dd1b75487cdf37a9241e8f263d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.4.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 523847c5c28be30dec51de265461176044b102dfbcb7083ab17ec76e7e9a041c
MD5 cfc178eddbb3b249e9250d9711be3289
BLAKE2b-256 6ee1c26322ce4e55695c60f938664425feef89e5be91462f1b80c672446f220d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modelexpress-0.4.1-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 62cd38552e4b3b1f941c5e7430efe154c619648b27c204c3a8c04c79d8184504
MD5 325397a7513323660629d19ca4ff0e28
BLAKE2b-256 2cadfc9c2a2738d5487a99f299d717b4289cf79f78bd563fa77237f375f05dee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page