Instructions to use ernie-research/Beers-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ernie-research/Beers-SFT with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ernie-research/Beers-SFT", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
View the Beers project on GitHub โ
Beers-SFT
Beers-SFT is a 4B-parameter multimodal model fine-tuned from the Beers / Cheers V2 training pipeline. It supports text-to-image generation, image editing, image understanding, and text generation through a Hugging Face Transformers-compatible interface.
This repository contains the SFT checkpoint. The checkpoint uses pixel-space diffusion and does not require a separate VAE.
Model details
- Model type: Beers V2 / Qwen3-VL 4B-based multimodal model
- Parameter count: approximately 4B
- Weight format: sharded
safetensors - Diffusion space: pixel space
- Default dtype:
bfloat16 - Image generation interface: flow matching with Euler updates
- Supported tasks: text-to-image, image editing, image understanding, text continuation, and chat-style text generation
Installation
Use a CUDA-enabled PyTorch environment. The commands below use the dependency versions validated with this checkpoint.
pip install -r requirements.txt
The model is loaded with trust_remote_code=True because the repository contains the custom Beers model implementation. Only load model repositories that you trust.
Quick start
After cloning or downloading this repository, set the model directory and use the included inference script.
MODEL_DIR=/path/to/Beers-SFT
python run.py \
--model-path "$MODEL_DIR" \
--mode generate \
--prompt "A white cat lying on the grass under warm afternoon light" \
--height 128 \
--width 128 \
--steps 75 \
--shift 3.0 \
--cfg-scale 4.0 \
--kappa 0.35 \
--seed 42 \
--output-dir ./outputs
The height and width arguments are image grid sizes. The output resolution is height * 16 by width * 16 pixels. The default --height 128 --width 128 produces a 2048 ร 2048 image. The model returns an RGB image in [0, 1], and the CLI saves it as generated.png.
The included CLI loads the model as follows.
import torch
from transformers import AutoModel
model = AutoModel.from_pretrained(
"/path/to/Beers-SFT",
trust_remote_code=True,
torch_dtype=torch.bfloat16,
device_map="auto",
)
model.eval()
Text-to-image generation
python run.py \
--model-path /path/to/Beers-SFT \
--mode generate \
--prompt "A small red cabin beside a quiet lake, detailed landscape photography" \
--height 128 \
--width 128 \
--steps 75 \
--shift 3.0 \
--cfg-scale 4.0 \
--kappa 0.35 \
--negative-prompt "blurry, distorted, low quality" \
--seed 123 \
--output-dir ./outputs/t2i
The corresponding Python API is model.generate_image.
from torchvision.utils import save_image
image = model.generate_image(
prompt="A small red cabin beside a quiet lake",
height=128,
width=128,
num_steps=75,
shift=3.0,
cfg_scale=4.0,
kappa=0.35,
negative_prompt="blurry, distorted, low quality",
seed=123,
)
save_image(image, "generated.png")
cfg_scale=1.0 disables text classifier-free guidance. Values greater than 1.0 enable it. ssg_scale=1.0 disables spatial sample guidance. Use even grid sizes for image tasks.
Image editing
Image editing takes a reference image and an instruction. The reference image is passed as a list containing one image segment and one text segment.
python run.py \
--model-path /path/to/Beers-SFT \
--mode edit \
--image ./input.png \
--prompt "Change the sky to a soft pink sunset" \
--height 128 \
--width 128 \
--steps 75 \
--shift 6.0 \
--cfg-scale 6.0 \
--image-cfg-scale 1.25 \
--kappa 0.35 \
--seed 42 \
--output-dir ./outputs/edit
The corresponding Python API is model.edit_image.
from torchvision.utils import save_image
image = model.edit_image(
prompt=[
{"type": "image", "image_path": "./input.png"},
{"type": "text", "text": "Change the sky to a soft pink sunset"},
],
height=128,
width=128,
num_steps=75,
shift=6.0,
cfg_scale=6.0,
kappa=0.35,
image_cfg_scale=1.25,
seed=42,
)
save_image(image, "edited.png")
cfg_scale controls text guidance and image_cfg_scale controls reference-image guidance. The output dimensions follow the same grid size * 16 rule as text-to-image generation.
Image understanding
python run.py \
--model-path /path/to/Beers-SFT \
--mode understand \
--image ./input.png \
--question "What is shown in this image?" \
--max-new-tokens 512 \
--no-do-sample
The corresponding Python API is model.understand.
answer = model.understand(
image_path="./input.png",
question="What is shown in this image?",
max_new_tokens=512,
do_sample=False,
)
print(answer)
Text and chat generation
For plain causal continuation use text mode.
python run.py \
--model-path /path/to/Beers-SFT \
--mode text \
--prompt "Once upon a time" \
--max-new-tokens 128
For a single user-to-assistant conversation turn use chat mode.
python run.py \
--model-path /path/to/Beers-SFT \
--mode chat \
--prompt "Explain why the sky is blue in simple language." \
--max-new-tokens 256
The Python methods are model.generate_text and model.generate_chat_text.
Generation parameters
| Argument | Meaning | Default |
|---|---|---|
--height / --width |
Image grid size. Pixel size is each value ร 16. | 128 (2048px) |
--steps |
Flow-matching denoising steps. | 75 |
--shift |
Flow scheduler shift. | 3.0 generate, 6.0 edit |
--cfg-scale |
Text classifier-free guidance scale. | 4.0 generate, 6.0 edit |
--image-cfg-scale |
Reference-image guidance scale for editing. | 1.25 |
--kappa |
Two-end-dense sigma schedule parameter. | 0.35 |
--ssg-scale |
Spatial sample guidance scale. | 1.0 |
--seed |
Random seed. | 42 |
--device |
Transformers device map, such as auto or cuda:0. |
auto |
Text generation uses max-new-tokens=512, temperature=0.7, top-p=0.8, top-k=20, and sampling by default. Pass --no-do-sample for greedy decoding.
Repository contents
model-00001-of-00002.safetensorsandmodel-00002-of-00002.safetensorscontain the model weights.model.safetensors.index.jsonmaps parameters to weight shards.configuration_cheers_v2.py,modeling_cheers_v2.py, andflux2_vae.pyprovide the custom model implementation required by Transformers.tokenizer.json,tokenizer_config.json,vocab.json,merges.txt, andchat_template.jsonprovide tokenizer assets.run.pyprovides single-sample inference for all supported modes.requirements.txtlists the Python dependencies.
Limitations
This is an SFT checkpoint from the Beers training pipeline. Image quality and instruction following depend on the prompt, resolution, sampling parameters, and input image. The public checkpoint was prepared for CUDA inference with bfloat16 weights.
The current release includes the custom Transformers code required by the checkpoint. It does not include a separate VAE because this checkpoint uses pixel-space diffusion.
License
This model is released under the Apache License 2.0.
Copyright ยฉ 2026 ERNIE Research. Please retain this attribution when redistributing the model or derived works.
Citation
@article{beers2026,
title = {Beers: Unlocking Pixel-Space Generation in Pretrained Vision-Language Model},
author = {Zhang, Yiqian and Hao, Xiangzhao and Song, Yi and Zhang, Yichen and Zhang, Zhenyu and Wang, Shijie and Miao, Jiaxu and Wang, Shuohuan and Yu, Jun and Yan, Junchi},
journal = {arXiv preprint arXiv:2612.03216},
year = {2026}
}
- Downloads last month
- 37