Instructions to use wesjos/Spark-x2.6-4B-HTML with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use wesjos/Spark-x2.6-4B-HTML with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="wesjos/Spark-x2.6-4B-HTML", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("wesjos/Spark-x2.6-4B-HTML", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use wesjos/Spark-x2.6-4B-HTML with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "wesjos/Spark-x2.6-4B-HTML" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "wesjos/Spark-x2.6-4B-HTML", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/wesjos/Spark-x2.6-4B-HTML
- SGLang
How to use wesjos/Spark-x2.6-4B-HTML 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 "wesjos/Spark-x2.6-4B-HTML" \ --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": "wesjos/Spark-x2.6-4B-HTML", "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 "wesjos/Spark-x2.6-4B-HTML" \ --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": "wesjos/Spark-x2.6-4B-HTML", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use wesjos/Spark-x2.6-4B-HTML with Docker Model Runner:
docker model run hf.co/wesjos/Spark-x2.6-4B-HTML
Spark-X2.6-4B · HTML
Spark-X2.6-4B fine-tuned to answer with rendered HTML — cards, tables, metric tiles and callouts instead of prose.
4.11 B params · bf16, 7.66 GiB in one shard · 1 M context · ships a WebUI · Apache-2.0
💾 Want the same model at 2.4 GB? → Spark-x2.6-4B-HTML-GGUF
The identical fine-tune, quantized:
Q4_K_Mat 2.42 GiB,Q8_0at 4.07 GiB. This repo is the full bf16 checkpoint (7.66 GiB) plus the WebUI.
🖼 Demo
Both shots are the bundled WebUI (webui/, theme_preset: notion) with the CoT toggle on — the
Chain of Thought panel above each answer is the raw <think> stream, and the page below it is the
unmodified render.
can u show me what ReLU looks like?
A definition card, a two-column grid with a plotted ReLU curve next to a domain/output/slope table, and a "Why It Matters in ML" bullet card. 30.09 s · 129 tok/s · 3882 tokens.
ReLU · a definition card, a ReLU curve beside a domain/output/slope table, and a “Why It Matters in ML” card
how to learn C++
A study-plan page: a "Why Start Here?" callout, four feature-list bullets, then a "Key Libraries" card with inline code chips.
C++ · a “Why Start Here?” callout, four feature-list bullets, and a “Key Libraries” card of inline code chips
📐 Specs
| Base | XHToken/Spark-X2.6-4B (Apache-2.0) |
| Architecture | Spark2_5ForCausalLM · 36 layers — 9 full-attention + 27 sliding-attention (window 512) · hidden 2560 |
| Attention | 16 heads / 4 KV heads · head_dim 256 · partial RoPE 0.25 on full-attention layers |
| Parameters | 4,112,079,360 (bf16, measured from the safetensors header) · 335.5 M embedding / 3.78 B non-embedding |
| On disk | 1 shard, 7.66 GiB |
| Context | 1,048,576 native (max_position_embeddings) · tokenizer advertises 131,072 |
| Vocab | 131,072 |
| Default system prompt | You are Mario-html. You are a helpful assistant who generates nice visual content. |
🚀 Quickstart
This repo's
tokenizer_config.jsondeclarestokenizer_class: "TokenizersBackend", which needstransformers>=5.0.0. Ontransformers==4.57.1(the version upstream pins)AutoTokenizerraisesValueError: Tokenizer class TokenizersBackend does not exist or is not currently imported.
pip install "transformers>=5.0.0" jinja2
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL = "wesjos/Spark-x2.6-4B-HTML"
tokenizer = AutoTokenizer.from_pretrained(MODEL, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
MODEL, trust_remote_code=True, dtype=torch.bfloat16, device_map="auto"
)
messages = [{"role": "user", "content": "can u show me what ReLU looks like?"}]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, tokenize=True,
return_dict=True, return_tensors="pt",
enable_thinking=True, reasoning_effort="low",
).to(model.device)
out = model.generate(**inputs, max_new_tokens=8192, do_sample=True,
temperature=0.7, top_p=0.8, top_k=40, repetition_penalty=1.05)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
llama.cpp — native spark2_5 support landed in b10828;
v0.9.0 has it too. The GGUF carries its own chat template, so no --chat-template-file is needed.
llama-cli -m Spark-x2.6-4B-HTML.Q4_K_M.gguf -p "can u show me what ReLU looks like?" -n 8192
🎨 WebUI
The repo ships a self-contained WebUI (webui/) that renders the model's HTML output live, with a
collapsible <think> panel, a raw-source view and a copy-HTML button per message, plus five theme presets
(default · apple · notion · cyber · editorial).
cd webui
pip install -r requirements.txt
python server.py --port 8798
Open http://localhost:8798. The UI talks to an OpenAI-compatible backend over webui/config.json —
by default http://127.0.0.1:18080 serving the alias Spark-x2.6-4B-HTML — and falls back to whatever the
backend actually serves if the alias has drifted.
webui/config.jsonshipsmodel_path: "/mnt/sdb/models/Spark-x2.6-4B-HTML/Spark-x2.6-4B-HTML-Q8_0.gguf"— a path from the training host that does not exist on any reader's machine. Point it at your own quant, or setbackend_mode: "direct"and let the UI manage the llama.cpp server for you.
Output contract
Class list verified against the shipped webui/static/theme.css:
| Component | Markup |
|---|---|
| Root | <div class="ai-view"> |
| Summary | <div class="summary"> · <div class="summary-card"> · <p class="lead"> |
| Card | <div class="card"> |
| Grid | <div class="grid grid-2"> · <div class="grid grid-3"> |
| Metrics | <div class="metric-group"><div class="metric-card"><span class="metric-label">…</span><span class="metric-value">…</span><span class="metric-sub">…</span></div></div> |
| Stepper | <div class="stepper"><div class="step-item">…</div></div> |
| Callout | <div class="callout callout-info|warning|success|danger"><div class="callout-header">…</div></div> |
| Badge | <span class="badge badge-info|success|warning|danger|accent"> |
| Table | <div class="table-container"><table class="modern-table">…</table></div> |
| Feature list | <div class="feature-list"><div class="feature-item">…</div></div> |
| Code block | <div class="code-box"><div class="code-header"><span class="code-title">…</span></div>…</div> |
💡 Notes
- The output is HTML, not Markdown. Render it in a container with
theme.css, or the classes fall back to browser defaults. - The persona is in the weights, and so is the system prompt. This repo's
chat_template.jinjaoverrides the upstream default with"You are Mario-html. You are a helpful assistant who generates nice visual content."— unlike the CuteHuman sibling, it is a template edit, not just a weight edit. - Its
generation_config.jsonis also its own:temperature 0.7 / top_p 0.8 / top_k 40 / repetition_penalty 1.05 / max_new_tokens 8192, where upstream ships1.0 / 0.95 / -1 / 1.0. The WebUI config agrees. reasoning_efforthas three levels here, not two. The WebUI offers 低 / 中 / 高 and the server mapslowandmediumtolow,highandxhightohigh— because the template only understandslowandhigh.
⚠️ Limitations
- The screenshots were taken under this repo's WebUI, but the crops shipped here were re-taken from the
originals and the
thinkingdropdown reads思考: 中(标准推演)— i.e.medium, which the server maps down toreasoning_effort: low. - No training metadata ships with this repo — no data size, no steps, no rank.
- Tool use is inherited and unaudited.
📄 License
Apache-2.0, inherited from the Spark-X2.6 model series.
- Downloads last month
- 47