Instructions to use SeeyonAI/seeyon-sii-4b-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use SeeyonAI/seeyon-sii-4b-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-4B") model = PeftModel.from_pretrained(base_model, "SeeyonAI/seeyon-sii-4b-lora") - Notebooks
- Google Colab
- Kaggle
seeyon-sii-4b-lora
LoRA adapter for Qwen/Qwen3.5-4B (revision 851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a) that turns English or Chinese UI requests into OpenUI Lang programs for the built-in OpenUI component library. Output is a bare program (no Markdown fences, no explanation) that starts with root = Stack(...).
This is the small, low-cost counterpart of SeeyonAI/seeyon-sii-27b-lora. It uses the same system prompts and output format. Use the 27B adapter where the last few points of accuracy matter, particularly for Chinese and multi-component requests.
Files
| File | Purpose |
|---|---|
adapter_model.safetensors, adapter_config.json |
PEFT LoRA weights (r = 16) for the language model only |
system-prompt.txt |
Required system prompt for English requests |
system-prompt-zh.txt |
Required system prompt for Chinese requests (same rules plus Chinese UI-text instructions) |
Required settings
- System prompt: send the full contents of
system-prompt.txt(orsystem-prompt-zh.txt) as the system message on every request. The adapter relies on it for component signatures; do not shorten it. - Thinking off: pass
enable_thinking: falseto the chat template. - Context: the prompt is about 7.1k tokens before the request; allow at least 12k tokens of context.
- Decoding: greedy (
temperature 0) andmax_tokensaround 2048. - Follow-up edits: keep earlier turns in
messages. The model returns a complete replacement program, not a diff. Use the model's own chat template, which drops earlier-turn reasoning blocks; the adapter expects exactly that format.
Serve with vLLM
vllm serve Qwen/Qwen3.5-4B --revision 851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a \
--max-model-len 20480 --limit-mm-per-prompt '{"image":0,"video":0}' \
--enable-lora --max-lora-rank 16 --lora-modules openui=SeeyonAI/seeyon-sii-4b-lora
from pathlib import Path
from openai import OpenAI
system = Path('system-prompt.txt').read_text()
client = OpenAI(base_url='http://localhost:8000/v1', api_key='EMPTY')
reply = client.chat.completions.create(
model='openui',
messages=[
{'role': 'system', 'content': system},
{'role': 'user', 'content': 'Show a card titled Weekly sales with a bar chart: Mon 12, Tue 18, Wed 9.'},
],
temperature=0,
max_tokens=2048,
extra_body={'chat_template_kwargs': {'enable_thinking': False}},
)
print(reply.choices[0].message.content)
On RTX PRO 6000 / other sm_120 GPUs with vLLM 0.30, set VLLM_USE_FLASHINFER_SAMPLER=0.
Use with Transformers + PEFT
from pathlib import Path
import torch
from peft import PeftModel
from transformers import AutoModelForImageTextToText, AutoTokenizer
base_id, rev = 'Qwen/Qwen3.5-4B', '851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a'
tokenizer = AutoTokenizer.from_pretrained(base_id, revision=rev)
model = AutoModelForImageTextToText.from_pretrained(base_id, revision=rev, dtype=torch.bfloat16, device_map='auto')
model = PeftModel.from_pretrained(model, 'SeeyonAI/seeyon-sii-4b-lora')
messages = [
{'role': 'system', 'content': Path('system-prompt-zh.txt').read_text()},
{'role': 'user', 'content': '显示一张卡片:本周订单 128 单,较上周增长 12%。'},
]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, enable_thinking=False, return_tensors='pt', return_dict=True).to(model.device)
output = model.generate(**inputs, max_new_tokens=2048, do_sample=False)
print(tokenizer.decode(output[0, inputs['input_ids'].shape[1]:], skip_special_tokens=True))
Install flash-linear-attention and causal-conv1d; without them, the model's linear-attention layers fall back to slow PyTorch code. To merge the adapter into the base weights, use model.merge_and_unload(); the merged model is about 9 GB in bf16.
Render the output
Parse and render programs with the OpenUI SDK versions the prompt was generated from: @openuidev/react-ui@0.18.0, @openuidev/react-lang@1.0.0, @openuidev/lang-core@1.0.0 (openuiLibrary). Validate before rendering, and treat form submissions and buttons as requests sent back to the assistant, not as completed backend actions.
Scope
- Covers the built-in
openuiLibrarycomponents, including static layouts and local reactive features (bindings, conditional visibility, modals,@Set/@Reset,@Count/@Sum/@Avg/@Filter/@Sort). - Not covered:
Query/Mutation/@Runtool integrations, incremental patch output, or custom component libraries. - Outputs fail schema validation more often than with the 27B adapter, typically through unresolved references or wrong argument types. Always parse with the SDK before display, and consider retrying or falling back to the 27B adapter when parsing fails.
- Downloads last month
- -