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
Download reference/midtrain/tokens.py from org2ai/Wald-4B: direct link, hf CLI and curl.
- Browser
- Download file 3.49 kB
-
https://huggingface.co/org2ai/Wald-4B/resolve/5428adeb2c54ad99a9ebebf737be670b766e8595/reference/midtrain/tokens.py
- Command line
-
hf download hf://org2ai/Wald-4B@5428adeb2c54ad99a9ebebf737be670b766e8595/reference/midtrain/tokens.py
-
curl -L -o tokens.py https://huggingface.co/org2ai/Wald-4B/resolve/5428adeb2c54ad99a9ebebf737be670b766e8595/reference/midtrain/tokens.py
3.49 kB
| """Delimiter and pause tokens. | |
| Every delimiter is exactly one token of the tokenizer. Where the tokenizer already defines a rarely used reserved token | |
| (Qwen: <|fim_prefix|> <|fim_middle|> <|box_start|> <|box_end|> <|fim_suffix|>, the same choice as Kev) it is reused and | |
| its embedding is simply trained along with everything else (full-parameter). Where a tokenizer lacks one (MiniCPM5 has | |
| no box tokens; SmolLM2 has none of them) the missing names are added as special tokens and the embedding matrix grows; | |
| the new rows start at the mean embedding. `<pause>` is always added: no base ships it. | |
| """ | |
| from dataclasses import dataclass, field | |
| ROLES = ("state", "q", "opt", "opt_end", "decide") | |
| # the Qwen names, reused verbatim where they exist and added under the same name where they do not, so one checkpoint | |
| # format serves every base | |
| PREFERRED = {"state": "<|fim_prefix|>", "q": "<|fim_middle|>", "opt": "<|box_start|>", "opt_end": "<|box_end|>", "decide": "<|fim_suffix|>"} | |
| PAUSE = "<pause>" | |
| # optional roles, installed only when named (so a run without them keeps its vocabulary): `think` opens a tier-2 | |
| # rationale (docs/reasoning-architecture.md); Qwen ships <think> as one token, other bases get it added | |
| OPTIONAL_ROLES = ("think",) | |
| THINK = "<think>" | |
| class Delimiters: | |
| ids: dict[str, int] # role -> token id (roles above plus "pause") | |
| names: dict[str, str] # role -> token string | |
| added: list[str] = field(default_factory=list) # tokens that were added to the tokenizer (need fresh embeddings) | |
| def __getitem__(self, role): | |
| return self.ids[role] | |
| def all_ids(self): | |
| return set(self.ids.values()) | |
| def to_dict(self): | |
| return {"ids": self.ids, "names": self.names, "added": self.added} | |
| def _is_single_token(tok, text): | |
| ids = tok(text, add_special_tokens=False).input_ids | |
| return len(ids) == 1 and tok.convert_tokens_to_ids(text) == ids[0] and ids[0] != tok.unk_token_id | |
| def install_delimiters(tok, names=None): | |
| """Resolve (and add where missing) the delimiter and pause tokens on a tokenizer, plus any optional role (`think`) | |
| that `names` gives. Returns Delimiters. The model's | |
| embeddings must be resized afterwards when `added` is non-empty (see model.MidtrainModel).""" | |
| names = {**PREFERRED, **(names or {})} | |
| names["pause"] = names.get("pause", PAUSE) | |
| roles = (*ROLES, "pause", *(r for r in OPTIONAL_ROLES if names.get(r))) | |
| existing = set(tok.get_vocab()) | |
| missing = [names[r] for r in roles if names[r] not in existing] | |
| if missing: | |
| tok.add_tokens(missing, special_tokens=True) | |
| ids = {r: tok.convert_tokens_to_ids(names[r]) for r in roles} | |
| for r, t in names.items(): | |
| if r not in ids: | |
| continue | |
| if ids[r] is None or ids[r] == tok.unk_token_id: | |
| raise ValueError(f"delimiter {r}={t!r} is not in the vocabulary after adding it") | |
| if not _is_single_token(tok, t): | |
| raise ValueError(f"delimiter {r}={t!r} does not tokenize to exactly one token") | |
| if len(set(ids.values())) != len(ids): | |
| raise ValueError(f"delimiter tokens collide: {ids}") | |
| return Delimiters(ids=ids, names={r: names[r] for r in ids}, added=missing) | |
| def pad_id(tok): | |
| """Right-padding id (never attended to).""" | |
| if tok.pad_token_id is not None: | |
| return tok.pad_token_id | |
| if tok.eos_token_id is not None: | |
| return tok.eos_token_id | |
| return 0 | |