umt5-xxl text encoder — 8-bit MLX
An 8-bit affine quantization (group size 64) of the umt5-xxl text encoder used by the Wan 2.1 / 2.2 and LingBot-World family of video generation models, converted to Apple MLX so it runs on the Apple Silicon GPU.
It replaces the 10.6 GB bf16 PyTorch checkpoint (models_t5_umt5-xxl-enc-bf16.pth)
with a 5.62 GiB MLX safetensors file. In the LingBot-World-V2 pipeline this
drops the text-encoder phase peak from ~14 GB to ~8 GB and encodes a prompt in
~1 s on an M4 Pro; the embeddings differ from the bf16 encoder by ~3% relative
— the same amount PyTorch-on-MPS differs from PyTorch-on-CPU, i.e. within the
noise floor of the bf16 reference itself.
Files
| File | Size | Description |
|---|---|---|
weights.safetensors | 5.62 GiB | 8-bit quantized encoder weights |
config.json | 274 B | architecture + quantization parameters |
tokenizer/ | 21 MB | umt5 sentencepiece tokenizer (AutoTokenizer-compatible) |
Accuracy
Measured against the original bf16 torch encoder on three prompts (including the canonical Chinese negative prompt), 512-token sequences:
| Metric | Value |
|---|---|
| Relative L2 error of embeddings | ~3% (torch-MPS vs. torch-CPU also differs by ~3%) |
| Cosine similarity | > 0.999 |
| Generated-clip PSNR | 39 dB (same seed, MLX vs. torch encoder, end to end) |
4-bit was measured too and rejected: 17–28% relative error on the same prompts.
Usage
With the LingBot-World-V2 Apple Silicon fork:
pip install -U huggingface_hub mlx
hf download PandacatAI/umt5-xxl-enc-mlx-q8 \
--local-dir ckpt/umt5-xxl-enc-mlx-q8
bash run_mps.sh ckpt 121 # --t5_backend auto picks up the MLX encoder
The MLX module that loads this repo (a port of the Wan torch encoder,
wan/modules/t5_mlx.py) lives in the fork. Other MLX pipelines can load
weights.safetensors directly with mlx.core.load: every linear layer is
stored as <name>.weight (packed uint32) plus <name>.scales and
<name>.biases for 8-bit affine quantization with group size 64, and the
relative-position tables are kept in bf16. config.json records the
architecture and quantization settings.
Provenance
- Encoder: google/umt5-xxl
(Apache-2.0), as packaged for Wan 2.1 in
Wan-AI/Wan2.1-T2V-14B
(
models_t5_umt5-xxl-enc-bf16.pth, Apache-2.0, 10.6 GiB, sha2567cace0da2b446bbbbc57d031ab6cf163a3d59b366da94e5afe36745b746fd81d). - Quantized with
tools/convert_t5_mlx.py(in the fork). No fine-tuning and no data: these weights are a lossy re-encoding of the bf16 encoder. weights.safetensorssha256:15c85f2f863ee42c2d36fce9c7a15d9d25814e2b4a5d14e809698b55b9deefb4.
License
Apache-2.0, inherited from the source encoder. Please keep the attribution to Google (umt5-xxl) and the Wan team when redistributing.