Text Generation
Transformers
Safetensors
English
German
qwen3_5
image-text-to-text
classification
router
lora
qwen3.5
simplixity
conversational
Instructions to use stneric/simplixity-router-2b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use stneric/simplixity-router-2b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="stneric/simplixity-router-2b") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("stneric/simplixity-router-2b") model = AutoModelForMultimodalLM.from_pretrained("stneric/simplixity-router-2b", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use stneric/simplixity-router-2b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "stneric/simplixity-router-2b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "stneric/simplixity-router-2b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/stneric/simplixity-router-2b
- SGLang
How to use stneric/simplixity-router-2b 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 "stneric/simplixity-router-2b" \ --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": "stneric/simplixity-router-2b", "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 "stneric/simplixity-router-2b" \ --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": "stneric/simplixity-router-2b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use stneric/simplixity-router-2b with Docker Model Runner:
docker model run hf.co/stneric/simplixity-router-2b
Download training/eval/eval_dev.py from stneric/simplixity-router-2b: direct link, hf CLI and curl.
- Browser
- Download file 4.52 kB
-
https://huggingface.co/stneric/simplixity-router-2b/resolve/main/training/eval/eval_dev.py
- Command line
-
hf download hf://stneric/simplixity-router-2b/training/eval/eval_dev.py
-
curl -L -o eval_dev.py https://huggingface.co/stneric/simplixity-router-2b/resolve/main/training/eval/eval_dev.py
4.52 kB
| """Agreement with the teacher on the held-out dev sets (synthetic and real). | |
| The dev items carry the teacher's (Haiku 5.5, thinking) label as their last | |
| message. A student is run on the same messages through Ollama, schema-forced, | |
| thinking off, and compared field by field. This is agreement, not accuracy: | |
| the hand-labelled testset.jsonl is the accuracy check. | |
| python3 eval_dev.py simplixity-router:2b-v1-q4_K_M [--num-gpu 99] | |
| """ | |
| import argparse | |
| import json | |
| import os | |
| import re | |
| import statistics | |
| import sys | |
| import time | |
| import urllib.error | |
| import urllib.request | |
| HERE = os.path.dirname(os.path.abspath(__file__)) | |
| ROOT = os.path.dirname(HERE) | |
| SCHEMA = json.load(open(os.path.join(HERE, "schema.json"))) | |
| SETS = {"syn": os.path.join(ROOT, "data", "valid.jsonl"), "real": os.path.join(ROOT, "data", "private", "valid_real.jsonl")} | |
| def run(model, messages, num_gpu): | |
| body = {"model": model, "messages": messages, "stream": False, "format": SCHEMA, "think": False, | |
| "options": {"temperature": 0, "num_ctx": 8192, "num_predict": 500}, "keep_alive": "10m"} | |
| if num_gpu is not None: | |
| body["options"]["num_gpu"] = num_gpu | |
| req = urllib.request.Request("http://localhost:11434/api/chat", json.dumps(body).encode(), | |
| {"Content-Type": "application/json"}) | |
| t = time.time() | |
| with urllib.request.urlopen(req, timeout=300) as r: | |
| out = json.load(r) | |
| return out["message"]["content"], time.time() - t | |
| def words(queries): | |
| return set(re.findall(r"\w+", " ".join(queries).lower())) | |
| def compare(student, teacher, settings): | |
| s = {"json": student is not None} | |
| if student is None: | |
| return s | |
| search = bool(student.get("needs_search")) or bool(student.get("wants_image")) | |
| s["search"] = search == teacher["needs_search"] | |
| if teacher["needs_search"] and search: | |
| for field in ("complexity", "answer_shape", "recency"): | |
| s[field] = str(student.get(field, "")).strip().lower() == teacher[field] | |
| s["image"] = bool(student.get("wants_image")) == teacher["wants_image"] | |
| if settings["auto_lenses"]: | |
| s["lenses"] = set(student.get("lenses") or []) == set(teacher["lenses"]) | |
| a, b = words(student.get("search_queries") or []), words(teacher["search_queries"]) | |
| s["query_overlap"] = len(a & b) / len(a | b) if a | b else 1.0 | |
| s["route"] = s["search"] and s["complexity"] and s["answer_shape"] | |
| return s | |
| def main(): | |
| p = argparse.ArgumentParser() | |
| p.add_argument("model") | |
| p.add_argument("--num-gpu", type=int, default=None) | |
| p.add_argument("--tag", default="") | |
| args = p.parse_args() | |
| tag = args.tag or args.model.replace(":", "-").replace("/", "_") | |
| for name, path in SETS.items(): | |
| rows = [json.loads(line) for line in open(path)] | |
| out_path = os.path.join(HERE if name == "syn" else os.path.join(ROOT, "data", "private"), | |
| f"dev-{name}-{tag}.jsonl") | |
| results = [] | |
| with open(out_path, "w") as f: | |
| for i, row in enumerate(rows): | |
| try: | |
| raw, dt = run(args.model, row["messages"][:-1], args.num_gpu) | |
| except urllib.error.HTTPError as e: # e.g. "token repeat limit reached": a failed call | |
| raw, dt = "", 0.0 | |
| print(f"\n{row['id']}: {e.read().decode()[:200]}", file=sys.stderr) | |
| try: | |
| student = json.loads(raw) | |
| except json.JSONDecodeError: | |
| student = None | |
| teacher = json.loads(row["messages"][-1]["content"]) | |
| r = {"id": row["id"], "score": compare(student, teacher, row["settings"]), "student": student, | |
| "seconds": round(dt, 3)} | |
| results.append(r) | |
| f.write(json.dumps(r, ensure_ascii=False) + "\n") | |
| print(f"{name} {i + 1}/{len(rows)}", file=sys.stderr, end="\r") | |
| if name == "real": | |
| os.chmod(out_path, 0o600) | |
| print(f"\n== {name} dev (n={len(rows)}, median {statistics.median(r['seconds'] for r in results):.2f}s)") | |
| for field in ("json", "search", "route", "complexity", "answer_shape", "recency", "image", "lenses", | |
| "query_overlap"): | |
| vals = [r["score"][field] for r in results if field in r["score"]] | |
| if vals: | |
| print(f" {field:14} {100 * sum(vals) / len(vals):5.1f}% (n={len(vals)})") | |
| if __name__ == "__main__": | |
| main() | |