Text Generation
Transformers
Safetensors
qwen3_5_moe_text
autoround
int3
int4
mixed-precision
Mixture of Experts
vllm
qwen3_5_moe
conversational
4-bit precision
auto-round
Instructions to use Beling86/Ornith-3.55BPW with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Beling86/Ornith-3.55BPW with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Beling86/Ornith-3.55BPW") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Beling86/Ornith-3.55BPW") model = AutoModelForCausalLM.from_pretrained("Beling86/Ornith-3.55BPW", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Beling86/Ornith-3.55BPW with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Beling86/Ornith-3.55BPW" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Beling86/Ornith-3.55BPW", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Beling86/Ornith-3.55BPW
- SGLang
How to use Beling86/Ornith-3.55BPW 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 "Beling86/Ornith-3.55BPW" \ --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": "Beling86/Ornith-3.55BPW", "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 "Beling86/Ornith-3.55BPW" \ --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": "Beling86/Ornith-3.55BPW", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Beling86/Ornith-3.55BPW with Docker Model Runner:
docker model run hf.co/Beling86/Ornith-3.55BPW
Download vllm-patch.py from Beling86/Ornith-3.55BPW: direct link, hf CLI and curl.
- Browser
- Download file 6.27 kB
-
https://huggingface.co/Beling86/Ornith-3.55BPW/resolve/main/vllm-patch.py
- Command line
-
hf download hf://Beling86/Ornith-3.55BPW/vllm-patch.py
-
curl -L -o vllm-patch.py https://huggingface.co/Beling86/Ornith-3.55BPW/resolve/main/vllm-patch.py
6.27 kB
| #!/usr/bin/env python3 | |
| """vllm-patch.py - fixes needed to serve our AutoRound mixed-bit checkpoints on stock vLLM 0.32 / 0.33. | |
| Two bugs in vLLM itself, identified while validating sibling mixed-bit checkpoints; each patch is a few lines, | |
| idempotent, keeps a `<file>.orig` backup, and reports "not applicable" if upstream already fixed it. | |
| 1. inc-routed-experts quantization/inc/config_parser.py | |
| INC resolves the bit-width of a fused MoE layer by gathering our per-expert `extra_config` keys, but | |
| only when the layer's class name contains "fusedmoe". The class is now `RoutedExperts`, so the branch | |
| is skipped, every MoE layer falls back to the GLOBAL bits (4) and the W3 experts are allocated with | |
| 4-bit containers (+~13 GiB: OOM before the weights are even read). | |
| 2. kda-eager-break model_executor/models/bailing_moe_v3.py | |
| `bailing_v3_kda_attention` does host-syncing work (boolean-mask indexing, chunk metadata). With the | |
| breakable-CUDA-graph capture it must be registered through `eager_break_during_capture`, like the other | |
| GDN/KDA ops; otherwise graph capture dies with cudaErrorStreamCaptureUnsupported. | |
| Usage (run with the python of the vLLM environment you serve with, or point at its site-packages): | |
| vllm-patch.py # apply to the vLLM importable by this interpreter | |
| vllm-patch.py --vllm-dir DIR # DIR = .../site-packages/vllm | |
| vllm-patch.py --check # report status only (exit 1 if a needed patch is missing) | |
| vllm-patch.py --revert # restore the .orig backups | |
| Checkpoint side (not a vLLM patch): the exported config.json must carry "model_type": "bailing_hybrid" | |
| (vLLM detects MLA from it). v3/fix_config.py does that in the quantization pipeline. | |
| """ | |
| import argparse | |
| import ast | |
| import importlib.util | |
| import os | |
| import shutil | |
| import sys | |
| PATCHES = [ | |
| { | |
| "name": "inc-routed-experts", | |
| "file": "model_executor/layers/quantization/inc/config_parser.py", | |
| "marker": "routedexperts", | |
| "edits": [( | |
| 'if self._config.extra_config and "fusedmoe" in layer.__class__.__name__.lower():', | |
| 'if self._config.extra_config and any(\n' | |
| ' k in layer.__class__.__name__.lower() for k in ("fusedmoe", "routedexperts")\n' | |
| ' ): # vLLM renamed FusedMoE -> RoutedExperts; the old check silently skipped per-expert bits', | |
| )], | |
| }, | |
| { | |
| "name": "kda-eager-break", | |
| "file": "model_executor/models/bailing_moe_v3.py", | |
| "marker": "eager_break_during_capture", | |
| "requires": "compilation/breakable_cudagraph.py", | |
| "edits": [ | |
| ( | |
| "from vllm.utils.torch_utils import direct_register_custom_op\n", | |
| "from vllm.compilation.breakable_cudagraph import eager_break_during_capture\n" | |
| "from vllm.utils.torch_utils import direct_register_custom_op\n", | |
| ), | |
| ( | |
| 'direct_register_custom_op(\n op_name="bailing_v3_kda_attention",\n op_func=bailing_v3_kda_attention,', | |
| "# The KDA state update does host-syncing work (boolean-mask indexing, chunk metadata), which is\n" | |
| "# illegal inside CUDA graph capture: make it a break point of the breakable-cudagraph capture,\n" | |
| "# like the other GDN/KDA ops (otherwise: cudaErrorStreamCaptureUnsupported).\n" | |
| 'direct_register_custom_op(\n op_name="bailing_v3_kda_attention",\n' | |
| " op_func=eager_break_during_capture(bailing_v3_kda_attention),", | |
| ), | |
| ], | |
| }, | |
| ] | |
| def find_vllm_dir(): | |
| spec = importlib.util.find_spec("vllm") # finds the package without importing it | |
| if spec is None or not spec.submodule_search_locations: | |
| sys.exit("vllm not importable by this python; pass --vllm-dir .../site-packages/vllm") | |
| return list(spec.submodule_search_locations)[0] | |
| def status(root, p): | |
| path = os.path.join(root, p["file"]) | |
| if not os.path.isfile(path): | |
| return path, "n/a", "file not present in this vLLM" | |
| if "requires" in p and not os.path.isfile(os.path.join(root, p["requires"])): | |
| return path, "n/a", f"{p['requires']} missing (older vLLM without breakable cudagraph)" | |
| src = open(path).read() | |
| if p["marker"] in src: | |
| return path, "applied", "already patched" | |
| if not all(old in src for old, _ in p["edits"]): | |
| return path, "n/a", "anchor text not found (fixed upstream or code changed)" | |
| return path, "pending", "needs patch" | |
| def main(): | |
| ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) | |
| ap.add_argument("--vllm-dir", help="path of the vllm package (site-packages/vllm)") | |
| ap.add_argument("--check", action="store_true", help="only report status") | |
| ap.add_argument("--revert", action="store_true", help="restore the .orig backups") | |
| a = ap.parse_args() | |
| root = os.path.abspath(a.vllm_dir) if a.vllm_dir else find_vllm_dir() | |
| ver = "" | |
| for d in os.listdir(os.path.dirname(root)): | |
| if d.startswith("vllm-") and d.endswith(".dist-info"): | |
| ver = d[5:-10] | |
| print(f"vLLM {ver or '?'} at {root}") | |
| missing = 0 | |
| for p in PATCHES: | |
| path, st, why = status(root, p) | |
| if a.revert: | |
| if os.path.isfile(path + ".orig"): | |
| shutil.copy2(path + ".orig", path) | |
| print(f" [{p['name']}] reverted from {os.path.basename(path)}.orig") | |
| else: | |
| print(f" [{p['name']}] nothing to revert (no .orig)") | |
| continue | |
| if st == "pending" and not a.check: | |
| src = open(path).read() | |
| for old, new in p["edits"]: | |
| src = src.replace(old, new, 1) | |
| ast.parse(src) # never write a file that does not parse | |
| if not os.path.exists(path + ".orig"): | |
| shutil.copy2(path, path + ".orig") | |
| open(path, "w").write(src) | |
| st, why = "applied", "patched now" | |
| print(f" [{p['name']}] {st}: {why}") | |
| missing += st == "pending" | |
| if a.check: | |
| sys.exit(1 if missing else 0) | |
| if __name__ == "__main__": | |
| main() | |