Model reference · open weights
UniAR-SFT is an open-weight language model from ShareLab-SII. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.
Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.
What it is
| Released by | ShareLab-SII |
|---|---|
| Type | Language models |
| Task | Image→text |
| Parameters (lead) | 9.6B |
| Context | 32k tokens |
| Runs with | diffusers |
| Released | 2026-06-16 |
| Popularity | 544 downloads / month |
| Licence | Open weights |
About
UniAR is a unified autoregressive multimodal model for image understanding, image generation, and image editing in a single Transformer. UniAR-SFT is the supervised fine-tuned checkpoint (before RL).
UniAR uses a single discrete visual tokenizer (BSQ) as the key bridge between understanding and generation, enabling a shared context where the model can directly interpret its own generated visual tokens. Key components:
This checkpoint (UniAR-SFT) is the supervised fine-tuned model before RL. It provides a good starting point for custom RL training.
This is a self-contained checkpoint with all components needed for both understanding and generation:
| Component | Path | Description |
|---|---|---|
| AR model | *.safetensors | Unified autoregressive model weights |
| BSQ encoder | bsq_encoder/ | BSQ quantized image tokenizer |
| SD3 transformer | sd3_transformer/ | SD3 transformer with visual feature injection |
| SD3 pipeline | sd3_pipeline/ | SD3 VAE + text encoders |
conda create -n uniar python=3.12 -y
conda activate uniar
git clone https://github.com/ShareLab-SII/UniAR.git
cd UniAR
pip install -e . # inference dependencies
import torch
from transformers import AutoProcessor
from uniar import UniARForConditionalGeneration
model_path = "ShareLab-SII/UniAR-SFT"
model = UniARForConditionalGeneration.from_pretrained(
model_path,
torch_dtype=torch.bfloat16,
attn_implementation="flash_attention_2",
).cuda().eval()
processor = AutoProcessor.from_pretrained(model_path)
messages = [{"role": "user", "content": [
{"type": "image", "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"},
{"type": "text", "text": "Describe this image in detail."},
]}]
inputs = processor.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
inputs.pop("mm_token_type_ids", None)
with torch.no_grad(), torch.autocast("cuda", dtype=torch.bfloat16):
output_ids = model.generate(**inputs, max_new_tokens=1024, do_sample=False)
output_ids = [o[len(i):] for i, o in zip(inputs.input_ids, output_ids)]
print(processor.batch_decode(output_ids, skip_special_tokens=True)[0])
import torch
from transformers import AutoProcessor
from uniar import UniARForConditionalGeneration, UniARVisualDecoder
from inference.visual_inputs import prepare_visual_inputs
model_path = "ShareLab-SII/UniAR-SFT"
device = torch.device("cuda")
ar_model = UniARForConditionalGeneration.from_pretrained(
model_path,
torch_dtype=torch.bfloat16,
attn_implementation="flash_attention_2",
).to(device).eval()
processor = AutoProcessor.from_pretrained(model_path, padding_side="left")
visual_decoder = UniARVisualDecoder.from_pretrained(model_path, device=device)
# prepare inputs
visual_inputs = prepare_visual_inputs(
["A cute anime girl."],
ar_model,
processor,
ar_height=960,
ar_width=960,
)
# autogressively generate visual indices
indices = ar_model.generate_visual(
**visual_inputs,
temperature=1.0,
cfg=1.5,
show_progress=True,
)
# decode visual indices into image
images = visual_decoder.decode(
indices,
ar_height=960,
ar_width=960,
upsampling_ratio=1.067,
)
images[0].save("output.png")
@article{peng2026unified,
title={Unified Multimodal Autoregressive Modeling with Shared Context-Visual Tokenizer is Key to Unification},
author={Peng, Wujian and Meng, Lingchen and Cai, Yuxuan and Zhuang, Xianwei and Yang, Yuhuan and Fang, Rongyao and Wu, Chenfei and Lin, Junyang and Wu, Zuxuan and Bai, Shuai},
journal={arXiv preprint arXiv:2606.18249},
year={2026}
}
From the published model card. Full card on the HuggingFace links in the sidebar.
Using it via the API
Once AxForge deploys uniar-sft for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (uniar-sft below is illustrative; you get the exact model name on deployment.)
$ curl -sS https://api.axforge.ai/v1/chat/completions \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"uniar-sft","messages":[{"role":"user","content":"Hello"}]}'
Create an account — your API key is available in the console. 3M free tokens every 30 days with every new account.