A compact, unified multimodal model family with a single shared vision–language backbone, built for on-device and in-app intelligence.
docs: document MLX inference for WePM 1.0
xiaoyuan1996ff38db1824a8
diff --git a/README.md b/README.mdindex a8d7c29..ac2ccf4 100644--- a/README.md+++ b/README.md@@ -18,6 +18,8 @@## News+- **2026-11-25** · WePM 1.0 [2B](https://huggingface.co/tencent/WePocketModel1.0-2B-MLX) and [4B](https://huggingface.co/tencent/WePocketModel1.0-4B-MLX) now support MLX inference on Apple silicon.+- **2026-11-24** · WePM featured by [Syncedreview (JiQiZhiXin)](https://mp.weixin.qq.com/s/uh-WMe_btZcI2qzNl7WOww) and now available on [ModelScope](https://www.modelscope.ai/collections/WeChat-Vision/WePocketModel).- **2026-11-23** · **WePM 1.0 is now open source.** Download the 2B and 4B [model weights](#model-weights) in Transformers and GGUF formats, try the [inference quick start](#quick-start), and read the [technical report](https://arxiv.org/abs/2611.27365).@@ -112,12 +114,12 @@ This repository provides the inference runtime and runnable examples for text ge### Model weights-| Model size | Transformers (safetensors) | GGUF (CPU) |-| --- | --- | --- |-| 2B | [WePocketModel1.0-2B](https://huggingface.co/tencent/WePocketModel1.0-2B) | [WePocketModel1.0-2B-GGUF](https://huggingface.co/tencent/WePocketModel1.0-2B-GGUF) |-| 4B | [WePocketModel1.0-4B](https://huggingface.co/tencent/WePocketModel1.0-4B) | [WePocketModel1.0-4B-GGUF](https://huggingface.co/tencent/WePocketModel1.0-4B-GGUF) |+| Model size | Transformers (safetensors) | GGUF (CPU) | MLX (Apple silicon) |+| --- | --- | --- | --- |+| 2B | [WePocketModel1.0-2B](https://huggingface.co/tencent/WePocketModel1.0-2B) | [WePocketModel1.0-2B-GGUF](https://huggingface.co/tencent/WePocketModel1.0-2B-GGUF) | [WePocketModel1.0-2B-MLX](https://huggingface.co/tencent/WePocketModel1.0-2B-MLX) |+| 4B | [WePocketModel1.0-4B](https://huggingface.co/tencent/WePocketModel1.0-4B) | [WePocketModel1.0-4B-GGUF](https://huggingface.co/tencent/WePocketModel1.0-4B-GGUF) | [WePocketModel1.0-4B-MLX](https://huggingface.co/tencent/WePocketModel1.0-4B-MLX) |-Run with a Hugging Face model ID from the table or a local checkpoint directory. Set `WEPM_MODEL` in the examples or pass `--model` to the CLI. By default, the examples use `tencent/WePocketModel1.0-4B`.+For Transformers and GGUF, use the corresponding Hugging Face model ID or a local checkpoint directory. Set `WEPM_MODEL` in the examples or pass `--model` to the CLI. By default, the examples use `tencent/WePocketModel1.0-4B`. MLX uses the self-contained runtime shipped in its Hugging Face repository; see [MLX on Apple silicon](#mlx-on-apple-silicon).### Quick start@@ -161,6 +163,35 @@ WEPM_MODEL=tencent/WePocketModel1.0-4B-GGUF bash examples/cpu/generation/run.shThe first run with a Hugging Face model ID downloads a complete snapshot into the Hub cache. To use a local copy, see the [checkpoint download instructions](checkpoints/README.md). The generation scripts also accept `single_image` and `interleaved`. See the [runnable examples](examples/README.md) for embeddings and decisions and the [inference guide](inference/README.md) for CLI flags, multimodal inputs, and raw training exports.+### MLX on Apple silicon++Use the runtime included in the corresponding Hugging Face repository. It supports generation, multimodal embeddings and structured decisions (JEV) on Apple silicon (M-series Macs). Use a separate environment from the PyTorch setup above.++```bash+python -m venv .venv-mlx+source .venv-mlx/bin/activate+python -m pip install huggingface_hub+hf download tencent/WePocketModel1.0-2B-MLX --local-dir WePocketModel1.0-2B-MLX+cd WePocketModel1.0-2B-MLX+python -m pip install -r requirements.txt++python runtime/infer_mlx.py --model . --task generate \+ --prompt "Describe WePM in one sentence." \+ --max-new-tokens 64 --output out/generation.json++python runtime/infer_mlx.py --model . --task embed \+ --prompt "Find similar landscape photos." \+ --embedding-dim 1024 --output out/embedding.json++python runtime/infer_mlx.py --model . --task decision \+ --decision-json request.json \+ --output out/decision.json+```++`request.json` follows the SystemOne protocol; [this example](examples/gpu/demo_data/decision/request.json) in the current repository can be used as a template, and the MLX model card documents the `choice` / `score` / `noul` variants.++For 4B, replace `WePocketModel1.0-2B-MLX` with `WePocketModel1.0-4B-MLX` in the download command and directory name. Add `--image /path/to/image.jpg` to the generation or embedding command for image input. The MLX model repositories include pinned dependencies and detailed usage instructions; this runtime is separate from this repository's Transformers/GGUF CLI.+### Hardware and precision (4B)| Backend | Device | Precision | Memory guidance |diff --git a/README_zh.md b/README_zh.mdindex bbef8c0..005d3ac 100644--- a/README_zh.md+++ b/README_zh.md@@ -18,6 +18,8 @@## 动态+- **2026-11-25** · WePM 1.0 的 [2B](https://huggingface.co/tencent/WePocketModel1.0-2B-MLX) 和 [4B](https://huggingface.co/tencent/WePocketModel1.0-4B-MLX) 已完成 MLX 适配,支持在 Apple silicon 上推理。+- **2026-11-24** · **WePM 获[机器之心](https://mp.weixin.qq.com/s/uh-WMe_btZcI2qzNl7WOww)报道,并同步上线 [ModelScope](https://www.modelscope.ai/collections/WeChat-Vision/WePocketModel)。**- **2026-11-23** · **WePM 1.0 正式开源。** 2B 和 4B 的[模型权重](#模型权重)均提供 Transformers 和 GGUF 格式。欢迎查看[推理快速开始](#快速开始)和[技术报告](https://arxiv.org/abs/2611.27365)。@@ -110,12 +112,12 @@ https://github.com/user-attachments/assets/4384a5c4-30a7-42da-8fe3-750285c1fa3e### 模型权重-| 模型尺寸 | Transformers (safetensors) | GGUF (CPU) |-| --- | --- | --- |-| 2B | [WePocketModel1.0-2B](https://huggingface.co/tencent/WePocketModel1.0-2B) | [WePocketModel1.0-2B-GGUF](https://huggingface.co/tencent/WePocketModel1.0-2B-GGUF) |-| 4B | [WePocketModel1.0-4B](https://huggingface.co/tencent/WePocketModel1.0-4B) | [WePocketModel1.0-4B-GGUF](https://huggingface.co/tencent/WePocketModel1.0-4B-GGUF) |+| 模型尺寸 | Transformers (safetensors) | GGUF (CPU) | MLX(Apple silicon) |+| --- | --- | --- | --- |+| 2B | [WePocketModel1.0-2B](https://huggingface.co/tencent/WePocketModel1.0-2B) | [WePocketModel1.0-2B-GGUF](https://huggingface.co/tencent/WePocketModel1.0-2B-GGUF) | [WePocketModel1.0-2B-MLX](https://huggingface.co/tencent/WePocketModel1.0-2B-MLX) |+| 4B | [WePocketModel1.0-4B](https://huggingface.co/tencent/WePocketModel1.0-4B) | [WePocketModel1.0-4B-GGUF](https://huggingface.co/tencent/WePocketModel1.0-4B-GGUF) | [WePocketModel1.0-4B-MLX](https://huggingface.co/tencent/WePocketModel1.0-4B-MLX) |-可以指定表中的 Hugging Face 模型 ID,也可以使用本地 checkpoint 目录。运行脚本示例时设置 `WEPM_MODEL`,使用推理 CLI 时传入 `--model`。示例默认使用 `tencent/WePocketModel1.0-4B`。+Transformers 和 GGUF 可以指定各自的 Hugging Face 模型 ID,也可以使用本地 checkpoint 目录。运行脚本示例时设置 `WEPM_MODEL`,使用推理 CLI 时传入 `--model`。示例默认使用 `tencent/WePocketModel1.0-4B`。MLX 使用对应 Hugging Face 仓库内的自包含运行时,见 [MLX(Apple silicon)](#mlxapple-silicon)。### 快速开始@@ -159,6 +161,35 @@ WEPM_MODEL=tencent/WePocketModel1.0-4B-GGUF bash examples/cpu/generation/run.sh首次使用 Hugging Face 模型 ID 时会将完整快照下载到 Hub 缓存。使用本地副本的方式见[权重下载指南](checkpoints/README.md)。生成脚本也支持 `single_image` 和 `interleaved`。嵌入和决策的调用方式见[可运行示例](examples/README.md),CLI 参数、多模态输入和原始训练导出见[推理指南](inference/README.md)。+### MLX(Apple silicon)++直接使用对应 Hugging Face 仓库内的运行时,即可在 Apple silicon(M 系列 Mac)上执行文本生成、多模态嵌入和结构化决策(JEV)。建议单独创建环境,不与上面的 PyTorch 环境混用。++```bash+python -m venv .venv-mlx+source .venv-mlx/bin/activate+python -m pip install huggingface_hub+hf download tencent/WePocketModel1.0-2B-MLX --local-dir WePocketModel1.0-2B-MLX+cd WePocketModel1.0-2B-MLX+python -m pip install -r requirements.txt++python runtime/infer_mlx.py --model . --task generate \+ --prompt "用一句话介绍 WePM。" \+ --max-new-tokens 64 --output out/generation.json++python runtime/infer_mlx.py --model . --task embed \+ --prompt "寻找相似的风景照片。" \+ --embedding-dim 1024 --output out/embedding.json++python runtime/infer_mlx.py --model . --task decision \+ --decision-json request.json \+ --output out/decision.json+```++`request.json` 遵循 SystemOne 协议,可直接以本仓库的[示例请求](examples/gpu/demo_data/decision/request.json)为模板;`choice`、`score`、`noul` 三种写法见 MLX 模型卡。++使用 4B 时,将下载命令和目录名中的 `WePocketModel1.0-2B-MLX` 替换为 `WePocketModel1.0-4B-MLX`。生成或嵌入命令增加 `--image /path/to/image.jpg` 即可输入图片。MLX 模型仓库包含版本固定的依赖与详细说明;其运行时独立于本 GitHub 仓库现有的 Transformers/GGUF CLI。+### 硬件与精度(4B)| 后端 | 设备 | 精度 | 内存参考 |diff --git a/checkpoints/README.md b/checkpoints/README.mdindex b467fe4..c66a0cb 100644--- a/checkpoints/README.md+++ b/checkpoints/README.md@@ -1,14 +1,15 @@# WePM Checkpoints-The 2B and 4B models each have a Transformers export and a GGUF bundle. The [model table](../README.md#model-weights) lists all four Hugging Face repositories.+The 2B and 4B models each have a Transformers export, a GGUF bundle and an MLX repository. The [model table](../README.md#model-weights) lists all six Hugging Face repositories.Use `hf download` to download a complete snapshot into a local directory. For example, choose one of the following 4B formats.```bashhf download tencent/WePocketModel1.0-4B --local-dir checkpoints/WePocketModel1.0-4Bhf download tencent/WePocketModel1.0-4B-GGUF --local-dir checkpoints/WePocketModel1.0-4B-GGUF+hf download tencent/WePocketModel1.0-4B-MLX --local-dir checkpoints/WePocketModel1.0-4B-MLX```-Use the corresponding 2B repository ID and destination directory for 2B. Set `WEPM_MODEL` to the directory you downloaded, or pass it to the inference CLI with `--model`. Use the CPU entry point for a GGUF bundle. See the [inference guide](../inference/README.md) for setup and required files.+Use the corresponding 2B repository ID and destination directory for 2B. Set `WEPM_MODEL` to the directory you downloaded, or pass it to the inference CLI with `--model`. Use the CPU entry point for a GGUF bundle. An MLX snapshot carries its own `runtime/` directory and requirements; see [MLX on Apple silicon](../README.md#mlx-on-apple-silicon). See the [inference guide](../inference/README.md) for setup and required files.Git ignores local download directories under `checkpoints/`.diff --git a/examples/README.md b/examples/README.mdindex 9ad7e2a..508544a 100644--- a/examples/README.md+++ b/examples/README.md@@ -72,4 +72,23 @@ Local model directories are loaded without network access. Set `HF_HUB_OFFLINE=1CPU examples also accept a local WePM GGUF bundle via `WEPM_MODEL` after [building the native library](../inference/README.md#gguf-on-cpu).+## Apple silicon (MLX)++The MLX examples are shipped inside the `-MLX` model repositories rather than in this directory, because that runtime is self-contained:++```bash+hf download tencent/WePocketModel1.0-4B-MLX --local-dir WePocketModel1.0-4B-MLX+cd WePocketModel1.0-4B-MLX+python -m pip install -r requirements.txt++python runtime/infer_mlx.py --model . --task generate --prompt "Describe WePM in one sentence." \+ --max-new-tokens 64 --output out/generation.json+python runtime/infer_mlx.py --model . --task embed --image /path/to/image.jpg \+ --embedding-dim 1024 --output out/embedding.json+python runtime/infer_mlx.py --model . --task decision --decision-json request.json \+ --output out/decision.json+```++See [MLX on Apple silicon](../README.md#mlx-on-apple-silicon) for setup and the decision request format.+GPU selection, CPU threads, and output location can be controlled with `CUDA_VISIBLE_DEVICES`, `WEPM_THREADS`, and `WEPM_OUTPUT_DIR` respectively. Set `WEPM_MIN_FREE_GIB` to override the default CUDA loading threshold of checkpoint size plus 2 GiB. Results are written to timestamped JSON files under each task's `results/` directory by default.diff --git a/inference/README.md b/inference/README.mdindex c6bd689..6121190 100644--- a/inference/README.md+++ b/inference/README.md@@ -1,6 +1,8 @@# WePM Inference-WePM `task_slots_v1` runs with Transformers on CPU or CUDA and with a native GGUF language backend on CPU. Both backends use the WePM vision encoder, MGVB, independent embedding and decision slots, and trained task heads.+WePM `task_slots_v1` runs with Transformers on CPU or CUDA, with a native GGUF language backend on CPU, and with MLX on Apple silicon. Every backend uses the WePM vision encoder, MGVB, independent embedding and decision slots, and trained task heads.++The MLX runtime is not part of this directory: it ships inside the `-MLX` model repositories together with the converted weights. See [MLX on Apple silicon](../README.md#mlx-on-apple-silicon).Supported tasks: