> ## Documentation Index
> Fetch the complete documentation index at: https://docs.m-star.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Install M*

> Install a release wheel on Linux, build current main from source, or run the CUDA and Intel XPU containers.

Use the Linux wheel to serve a released model. Build from a checkout for changes on main or work on the engine. AMD ROCm support is in progress and requires a source build. The [quickstart](https://docs.m-star.org/quickstart.md) takes the wheel path through a first reply.

## Before you install

* On Linux x86-64 or aarch64, 0.3.0 ships native wheels for CPython 3.12, 3.13, and 3.14. Python 3.12 has the widest model-extra coverage.
* Choose a [model](https://docs.m-star.org/models.md#matrix) and check its GPU count and extra. The examples below use BAGEL on one NVIDIA GPU.
* Install [uv](https://docs.astral.sh/uv/). NVIDIA models build some kernels on first use and need a local CUDA toolkit. A CUDA 13 build of PyTorch needs driver r580 or newer. [Check your toolkit](#cuda-toolkit).

## Install the Linux wheel

```bash theme={null}
uv venv --python 3.12 --seed
source .venv/bin/activate
uv pip install --torch-backend=auto 'mstar-ai[bagel]'
```

The distribution is `mstar-ai`; Python imports it as `mstar`. The native wheel includes the Rust extension, HTTP server, and default deployment configs. A generic Python wheel lacks the two native components required to serve. [Verify your installation](#verify).

## Build current main

Start in a fresh environment. On NVIDIA, run the following from the machine that will serve the model. Install [rustup](https://rustup.rs/) and a C/C++ toolchain first. The checkout pins the Rust compiler version.

```bash theme={null}
git clone https://github.com/mstar-project/mstar.git
cd mstar
uv venv --python 3.12 --seed
source .venv/bin/activate
uv pip install --torch-backend=auto -e '.[bagel]'
uv pip install maturin
maturin develop --release -m rust/Cargo.toml
cargo build --release --manifest-path rust/server/Cargo.toml
```

### Rebuild the Rust components

Rebuild both components when their sources change. A source-hash mismatch at startup identifies the stale build. If you set `CARGO_TARGET_DIR`, set `MSTAR_SERVER_BIN` to the binary in its `release` directory. See [server flags](https://docs.m-star.org/reference/cli.md) for an explicit binary override.

From the repository root, `rust/server/target/release/mstar-server --source-hash` prints the hash of the built frontend. A separately installed `mstar-rust` can shadow the wheel’s extension. For a source build, run the Rust tests after building the extension and HTTP server:

```bash theme={null}
(cd rust && cargo test --release --no-default-features --features python)
cargo test --release --manifest-path rust/server/Cargo.toml
python -m pytest test/rust
```

Without the extension the Python Rust integration tests skip.

## Install on AMD ROCm

Use current main and a working ROCm PyTorch environment for the in-progress [AMD backend](https://docs.m-star.org/hardware.md#amd). Install the AITER distribution for your ROCm environment (`amd-aiter`). Autoregressive models also use AMD’s FlashInfer fork for RMSNorm, RoPE, and sampling. Both NVIDIA’s distribution and the AMD fork provide the Python name `flashinfer`. When installing a model extra, exclude NVIDIA’s package from the resolution.

```bash theme={null}
# From the M* source checkout, in the ROCm environment
printf '%s\n' 'flashinfer-python; sys_platform == "never"' > rocm-overrides.txt
uv pip install --overrides rocm-overrides.txt -e '.[bagel]'
git clone --branch 'v0.6.18+amd.2' https://github.com/ROCm/flashinfer.git amd-flashinfer
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_AMD_FLASHINFER=0.6.18+amd.2 uv pip install ./amd-flashinfer
python -c 'import aiter; import flashinfer.rocm'
```

Build the two [Rust components](#install-from-source) in the same environment. The AMD fork builds its HIP kernels with `hipcc` on first use. Its cache defaults to `~/.cache/flashinfer`. Keep using the override when changing extras.

AITER serves eligible paged, cross, and ragged attention. AMD FlashInfer is required for power-of-two page sizes up to 64, windowed or scaled paged attention, context parallelism, or sequence-parallel split steps. Non-causal multi-query paged steps and block-causal ragged attention can first require it during warmup or the first such request.

## Model dependencies

Use the **Extra** column in the [model catalog](https://docs.m-star.org/models.md#matrix). Add extras together, for example `'mstar-ai[qwen3_omni,audio]'`. Install `metrics` for Prometheus, `vad` for server-side turn detection, and `audio` for compressed audio formats. The `all` extra omits some model-specific dependencies. Install the extra for the family you serve.

On Python 3.13 and later, Kokoro accepts phonemes supplied by the caller but lacks the text-to-phoneme package used for plain text. Use Python 3.12 for text input. Waypoint’s serving path works on Python 3.14, where its parity-test dependency `tensordict` is excluded. The `all` extra includes AudioSeal. M\* requires `torch>=2.10,<2.13`. The ASR extra pins its PyTorch stack to 2.10.

### Additional packages

* [OmniVoice](https://docs.m-star.org/models/omnivoice.md#serve) requires `uv pip install "git+https://github.com/k2-fsa/OmniVoice.git"`.
* [Qwen3-TTS](https://docs.m-star.org/models/qwen3-tts.md#serve) requires `uv pip install --no-deps "qwen-tts==0.1.1"`.
* [LingBot-World](https://docs.m-star.org/models/world-models.md#serve) requires FlashAttention for `reference_numerics: true`. BAGEL’s vision encoder can use PyTorch SDPA when FlashAttention is absent.
* [Waypoint](https://docs.m-star.org/models/world-models.md#waypoint-install) requires a pinned TAEHV decoder and can use FlashAttention-4.

On torch 2.10/CUDA 13, install the matching [FlashAttention wheel by direct URL](https://docs.m-star.org/models/world-models.md#lingbot-install). With `--find-links`, the resolver can prefer a CUDA 13 build on CUDA 12. An undefined-symbol import failure usually indicates a PyTorch or CUDA ABI mismatch. The 2.8.3 kernels for Blackwell do not build with nvcc 13. When compiling for Hopper, exclude those targets.

A FlashAttention wheel must match Python, PyTorch, CUDA, and the platform. For a source build on Hopper, use the local PyTorch environment and target Hopper explicitly.

```bash theme={null}
uv pip install psutil
FLASH_ATTN_CUDA_ARCHS=90 uv pip install flash-attn==2.8.3.post1 --no-build-isolation
```

## Match the CUDA toolkit

```bash theme={null}
python -c 'import torch; print(torch.__version__, torch.version.cuda)'
nvcc --version
```

`--torch-backend=auto` selects PyTorch using the driver. Source builds such as the MoE align kernel also check the major version of the installed toolkit. If the driver supports CUDA 13 but `nvcc` reports CUDA 12.9, install into a fresh environment with an explicit backend, for example `uv pip install --torch-backend=cu129 'mstar-ai[bagel]'`. Set `CUDA_HOME` if you have multiple toolkits. PyPI’s torch 2.12 wheel uses CUDA 13.0. With torch 2.10, install a matching torchvision and torchaudio from the same PyTorch wheel index, then `uv pip install "torchcodec==0.10.*"` for media decoding.

## Containers

From the root of a source checkout, build the CUDA serving image and start BAGEL. The named volumes retain weights and compiled kernels across restarts.

```bash theme={null}
docker build -f mstar/integrations/dynamo/docker/Dockerfile --target serve -t mstar-serve .
docker run --rm -it --gpus all --ipc=host -p 127.0.0.1:8000:8000 \
  -v mstar-weights:/root/.cache/huggingface -v mstar-cache:/root/.cache/mstar \
  mstar-serve mstar serve bagel
```

### Intel XPU

The host needs Intel GPU drivers and `/dev/dri`. The XPU Dockerfile clones M\* at build time. Pass `--build-arg MSTAR_REF=<tag-or-branch>` to select a revision.

```bash theme={null}
docker build -t mstar:xpu - < docker/Dockerfile.xpu
docker run --rm -it --device=/dev/dri --ipc=host -p 127.0.0.1:8000:8000 \
  -v /dev/dri/by-path:/dev/dri/by-path:ro \
  -v mstar-weights:/root/.cache/huggingface -v mstar-cache:/root/.cache/mstar mstar:xpu
```

Inside the container, start the three-GPU deployment.

```bash theme={null}
cd /mstar-workspace/mstar
mstar serve bagel --config configs/bagel_xpu_tp2.yaml
```

## Verify the install

```bash theme={null}
python -c 'import mstar_rust; print(mstar_rust.__version__)'
python -c 'from mstar.api_server.rust_frontend import find_server_binary; print(find_server_binary())'
```

The first command prints the extension version. The second prints the binary that M\* will launch. A wheel install should resolve it inside the active environment. Then [start the server and send a request](https://docs.m-star.org/quickstart.md).

## Troubleshooting

### Missing cuDNN sublibrary

If a CUDA 12 environment with cuDNN 9.20.0.48 reports `CUDNN_STATUS_SUBLIBRARY_VERSION_MISMATCH` and loads a newer system copy, install a complete cuDNN 9 build in that environment with `uv pip install --no-deps -U "nvidia-cudnn-cu12>=9.21,<10"`.

### Mooncake cannot load libcudart.so.12

The TCP and RDMA transports use Mooncake. On CUDA 13, replace the CUDA 12 wheel installed by the model extra. Repeat the swap if you reinstall that extra. The default single-host SHM transport does not require this step.

```bash theme={null}
uv pip uninstall mooncake-transfer-engine
uv pip install --reinstall --no-deps mooncake-transfer-engine-cuda13
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.