Instructions to use sapidlabs/Hy3-REAP-48e with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sapidlabs/Hy3-REAP-48e with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sapidlabs/Hy3-REAP-48e") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sapidlabs/Hy3-REAP-48e") model = AutoModelForCausalLM.from_pretrained("sapidlabs/Hy3-REAP-48e") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sapidlabs/Hy3-REAP-48e with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sapidlabs/Hy3-REAP-48e" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sapidlabs/Hy3-REAP-48e", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sapidlabs/Hy3-REAP-48e
- SGLang
How to use sapidlabs/Hy3-REAP-48e with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "sapidlabs/Hy3-REAP-48e" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sapidlabs/Hy3-REAP-48e", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "sapidlabs/Hy3-REAP-48e" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sapidlabs/Hy3-REAP-48e", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sapidlabs/Hy3-REAP-48e with Docker Model Runner:
docker model run hf.co/sapidlabs/Hy3-REAP-48e
Hy3-REAP-48e — REAP-pruned Hunyuan Hy3 (experimental)
An expert-pruned version of tencent/Hy3,
produced with REAP (Router-weighted Expert Activation Pruning). Each MoE
layer's 192 routed experts are reduced to the 48 most salient, shrinking the
checkpoint from 557 GB to 157 GB (BF16).
⚠️ Experimental research artifact. This is an aggressive prune (75% of experts removed) calibrated on a small, code-only set. It generates fluent text and is genuinely strong at code, but general/factual accuracy is degraded (see below). Not intended for production. A better-calibrated version is planned — this repo will be updated in place.
| Base | This model | |
|---|---|---|
| Routed experts / MoE layer | 192 | 48 |
| Experts per token | 8 | 8 (unchanged) |
| Size (BF16) | ~557 GB | ~157 GB |
| Architecture | hy_v3 (HYV3ForCausalLM) |
same |
How it was made
The entire pipeline ran on a single NVIDIA DGX Spark (128 GB) — a model far larger than RAM — using per-layer disk streaming:
- Method: REAP, one-shot (no retraining). Each expert is scored by the mean
of
router_weight × activation_normover a calibration set; the least-salient are dropped. - Compression:
compression_ratio 0.75→ 192 → 48 experts kept per MoE layer. - Calibration: 64 samples from
theblackcat102/evol-codealpaca-v1(code). - Streaming: the 557 GB model was built on
metaand each of the 80 layers streamed from the on-disk safetensors shards (~7 GB resident at a time), for both calibration and the prune. See the How To Spark training notes for the recipe.
Quality profile (sanity check)
Fluent everywhere; quality tracks the (code-only) calibration domain:
| Prompt | Output |
|---|---|
| Write an nth-Fibonacci function | Correct, well-documented Python ✅ |
| "The sky is…" | "Blue." ✅ |
| Capital of France? | "France does not have a single capital city…" ❌ (fluent but wrong) |
The pattern is expected: code experts (the calibration domain) survived; experts carrying broad world-knowledge scored low on code data and were pruned. A larger, more diverse calibration set and/or a gentler prune ratio would recover accuracy.
Running it
At 157 GB BF16 this exceeds a single 128 GB device. Options:
- Two GPUs / two nodes — e.g.
vllm serve <repo> --pipeline-parallel-size 2(vLLM supportsHYV3ForCausalLM). This model was validated running pipeline-parallel across two DGX Sparks. - 4-bit quantization (~40 GB) to fit a single device (tooling for
hy_v3quantization is still maturing).
License
Inherits the base model's license (Apache-2.0). Derivative of tencent/Hy3.
- Downloads last month
- 184
Model tree for sapidlabs/Hy3-REAP-48e
Base model
tencent/Hy3