Text Generation
Transformers
Safetensors
GGUF
English
qwen3_5
image-text-to-text
decision-model
typed-decisions
calibration
calibrated-probabilities
classification
tool-selection
agent-routing
decision-index
jevbench
jev-compatible
systemone
wald
wald-q4b
qwen3.5
4b
vllm
reasoning
llama.cpp
conversational
Eval Results (legacy)
Instructions to use org2ai/Wald-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use org2ai/Wald-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="org2ai/Wald-4B") 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("org2ai/Wald-4B") model = AutoModelForMultimodalLM.from_pretrained("org2ai/Wald-4B", 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 org2ai/Wald-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "org2ai/Wald-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "org2ai/Wald-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/org2ai/Wald-4B
- SGLang
How to use org2ai/Wald-4B 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 "org2ai/Wald-4B" \ --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": "org2ai/Wald-4B", "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 "org2ai/Wald-4B" \ --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": "org2ai/Wald-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use org2ai/Wald-4B with Docker Model Runner:
docker model run hf.co/org2ai/Wald-4B
org2ai
Wald-Q4B v2 (04701-c22 + Qwen3.5-4B vision tower): main = v2; v1.x at tags v1.2 / v1.2-main / v1.1 / v1.0
ef7481d Download server/tests/test_vision_v2.py from org2ai/Wald-4B: direct link, hf CLI and curl.
- Browser
- Download file 5.93 kB
-
https://huggingface.co/org2ai/Wald-4B/resolve/main/server/tests/test_vision_v2.py
- Command line
-
hf download hf://org2ai/Wald-4B/server/tests/test_vision_v2.py
-
curl -L -o test_vision_v2.py https://huggingface.co/org2ai/Wald-4B/resolve/main/server/tests/test_vision_v2.py
5.93 kB
| """CPU tests of the image route (vision_v2): transports, sentinels, prompt splitting and the completions <-> chat mapping.""" | |
| import base64, io, json, sys | |
| from pathlib import Path | |
| import pytest | |
| from wald_serve import vision_v2 as v # noqa: E402 | |
| def png_uri(color=(10, 20, 30)): | |
| from PIL import Image | |
| b = io.BytesIO(); Image.new("RGB", (8, 8), color).save(b, format="PNG") | |
| return "data:image/png;base64," + base64.b64encode(b.getvalue()).decode() | |
| Q = {"q": {"type": "choice", "instructions": "Which?", "criteria": {"a": "left", "b": "right"}}} | |
| def test_no_images_is_not_routed(): | |
| assert not v.has_images({"state": "light: red", "questions": Q}) | |
| assert not v.has_images({"state": {"messages": [{"role": "user", "content": [{"type": "text", "text": "x"}]}]}, "questions": Q}) | |
| def test_transports_lift_to_one_sentinel(make): | |
| u = png_uri(); req = make(u) | |
| assert v.has_images(req) | |
| out, uris, pat = v.lift(req) | |
| assert uris == [u] and set(out) == {"state", "questions"} | |
| s = json.dumps(out["state"], ensure_ascii=False) | |
| assert len(pat.findall(s)) == 1 and "data:image" not in s | |
| def test_messages_flatten_keeps_position(): | |
| u = png_uri() | |
| out, uris, pat = v.lift({"state": {"messages": [{"role": "user", "content": [{"type": "text", "text": "A"}, {"type": "image_url", "image_url": {"url": u}}, | |
| {"type": "text", "text": "B"}]}]}, "questions": Q}) | |
| assert isinstance(out["state"], str) | |
| a, rest = out["state"].split("\n", 1) | |
| assert a == "A" and pat.fullmatch(rest.split("\n")[0]) and rest.endswith("\nB") | |
| def test_to_parts_and_repeat(): | |
| u1, u2 = png_uri((1, 1, 1)), png_uri((2, 2, 2)) | |
| out, uris, pat = v.lift({"images": [u1, u2], "state": "S", "questions": Q}) | |
| m0, m1 = [m.group(0) for m in pat.finditer(out["state"])] | |
| text = f"<|im_start|>user\nState:\n{m0}\n{m1}\nS\n\nRead again:\n{m0}\n{m1}\nS<|im_end|>" | |
| parts = v.to_parts(text, uris, pat) | |
| imgs = [p for p in parts if p["type"] == "image_url"] | |
| assert [p["image_url"]["url"] for p in imgs] == [u1, u2, u1, u2] | |
| assert "".join(p["text"] if p["type"] == "text" else v.VISION for p in parts).count(v.VISION) == 4 | |
| with pytest.raises(v.ImageError): | |
| v.to_parts("no slots here", uris, pat) | |
| def test_limits_and_bad_images(): | |
| u = png_uri() | |
| with pytest.raises(v.ImageError): | |
| v.lift({"images": [u] * 17, "state": "s", "questions": Q}) | |
| with pytest.raises(v.ImageError): | |
| v.lift({"images": ["data:image/png;base64," + base64.b64encode(b"notanimage" * 10).decode()], "state": "s", "questions": Q}) | |
| def test_image_client_maps_completions_to_chat(): | |
| calls = [] | |
| class Base: | |
| served = "m" | |
| def post(self, path, body, retries=1): | |
| calls.append((path, body)) | |
| if path == "/detokenize": | |
| return {"prompt": "<|im_start|>user\n" + body["_text"] if "_text" in body else "<|im_start|>user\nX " + MARK + " Y<|im_end|>"} | |
| if path == "/v1/chat/completions": | |
| if body.get("max_tokens") == 1: | |
| return {"choices": [{"index": 0, "message": {"content": "A"}, "finish_reason": "length", | |
| "logprobs": {"content": [{"token": "token_id:32", "logprob": -0.1, | |
| "top_logprobs": [{"token": "token_id:32", "logprob": -0.1}, {"token": "token_id:33", "logprob": -2.4}]}]}}], | |
| "usage": {"prompt_tokens": 50, "completion_tokens": 1}} | |
| return {"choices": [{"index": 0, "message": {"content": "thinking"}, "finish_reason": "stop", "stop_reason": "</think>"}], | |
| "usage": {"completion_tokens": 7}} | |
| return {"tokens": [1, 2, 3]} | |
| u = png_uri() | |
| _, uris, pat = v.lift({"images": [u], "state": "s", "questions": Q}) | |
| global MARK | |
| MARK = "⟦" + pat.pattern.split("⟦")[1].split(":")[0] + ":0⟧" | |
| C = v.image_client(Base) | |
| c = C().bind(uris, pat) | |
| r = c.post("/v1/completions", {"model": "m", "prompt": [5, 6, 7], "max_tokens": 1, "temperature": 0.0, "logprobs": 20, | |
| "logprob_token_ids": [32, 33], "return_tokens_as_token_ids": True}) | |
| assert r["choices"][0]["logprobs"]["top_logprobs"][0] == {"token_id:32": -0.1, "token_id:33": -2.4} | |
| chat = calls[-1][1] | |
| assert calls[-1][0] == "/v1/chat/completions" and chat["chat_template"] == v.CHAT_TEMPLATE and chat["add_generation_prompt"] is False | |
| assert chat["logprob_token_ids"] == [32, 33] and chat["top_logprobs"] == 20 and chat["logprobs"] is True | |
| assert [p["type"] for p in chat["messages"][0]["content"]] == ["text", "image_url", "text"] | |
| g = c.post("/v1/completions", {"model": "m", "prompt": [5], "max_tokens": 512, "stop": ["</think>"], "seed": 3}) | |
| assert g["choices"][0]["text"] == "thinking" and g["usage"]["completion_tokens"] == 7 and g["choices"][0]["stop_reason"] == "</think>" | |
| # without bound images, every call passes through untouched | |
| c.bind([], None); n = len(calls) | |
| c.post("/v1/completions", {"model": "m", "prompt": [5]}) | |
| assert calls[n][0] == "/v1/completions" | |