Run this model with HF Jobs

Run CodeImageGen/Pictor-27B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/CodeImageGen/Pictor-27B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/CodeImageGen/Pictor-27B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/CodeImageGen/Pictor-27B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/CodeImageGen/Pictor-27B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="CodeImageGen/Pictor-27B")
messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe(messages)
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("CodeImageGen/Pictor-27B")
model = AutoModelForCausalLM.from_pretrained("CodeImageGen/Pictor-27B", device_map="auto")
messages = [
    {"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

Pictor-27B

Pictor-27B writes JavaScript programs that render images from a text prompt. It is Qwen3.8-27B trained with SFT on teacher programs and GRPO with the image+program reward (IPR).

Paper Β· Project page Β· Code (coming soon)

setting value
Base Qwen/Qwen3.8-27B
Training SFT, then GRPO
Reward IPR (program + image)
Steps GRPO step 250
Precision fp16, merged weights

The model writes a JavaScript program for a text prompt. The image is the program rendered in headless Chrome.

Use

python -m grpo.t2i.eval.generate_one --model CodeImageGen/Pictor-27B --prompt "a red fox in the snow" --out fox.png

Setup (renderer, environment): the GitHub repo, coming soon.

model-mtp.safetensors is the MTP head for speculative decoding. It is optional.

Results

GenEval2: GM 49.5, AM 77.4.

Other models

License

Apache-2.0, the licence of the base model. This is a modified version of Qwen3.8-27B: fine-tuned with SFT and GRPO.

Citation

@article{wang2026codeimagegen,
  title   = {Code-based Image Generation: Benchmarking, Baselines, and Improved Rewards},
  author  = {Wang, Nicole and Liang, Zhanhao and Leng, Xingjian and Zheng, Liang},
  journal = {arXiv preprint arXiv:2612.02434},
  year    = {2026}
}
Downloads last month
1,029
Safetensors
Model size
27B params
Tensor type
F16
Β·
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for CodeImageGen/Pictor-27B

Base model

Qwen/Qwen3.8-27B
Finetuned
(1,131)
this model
Quantizations
5 models

Space using CodeImageGen/Pictor-27B 1

Collection including CodeImageGen/Pictor-27B

Paper for CodeImageGen/Pictor-27B