Beers project banner

Images generated by Beers

View the Beers project on GitHub →

Beers-CPT

Beers-CPT is the continued-pretraining checkpoint from the Beers / Cheers V2 multimodal training pipeline. It is based on the Beers Base model and supports text-to-image generation, image editing, image understanding, and text generation through a Hugging Face Transformers-compatible interface.

This repository contains the Stage 4 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
  • Release: CPT
  • Training stage: Stage 4
  • 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.

pip install -r requirements.txt

The model is loaded with trust_remote_code=True because this repository contains the custom Beers model implementation. Only load model repositories that you trust.

Quick start

MODEL_DIR=/path/to/Beers-CPT

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 can also be loaded directly with Transformers.

import torch
from transformers import AutoModel

model = AutoModel.from_pretrained(
    "/path/to/Beers-CPT",
    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-CPT \
  --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

Python API:

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

python run.py \
  --model-path /path/to/Beers-CPT \
  --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

Python API:

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")

Image understanding

python run.py \
  --model-path /path/to/Beers-CPT \
  --mode understand \
  --image ./input.png \
  --question "What is shown in this image?" \
  --max-new-tokens 512 \
  --no-do-sample

Python API:

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

python run.py --model-path /path/to/Beers-CPT --mode text --prompt "Once upon a time" --max-new-tokens 128
python run.py --model-path /path/to/Beers-CPT --mode chat --prompt "Explain why the sky is blue." --max-new-tokens 256

The corresponding 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.safetensors and model-00002-of-00002.safetensors contain the model weights.
  • model.safetensors.index.json maps parameters to weight shards.
  • configuration_cheers_v2.py, modeling_cheers_v2.py, and flux2_vae.py provide the custom model implementation required by Transformers.
  • Tokenizer and processor files provide the text and image preprocessing assets.
  • run.py provides single-sample inference for all supported modes.
  • requirements.txt lists the Python dependencies.

Limitations

This is the Stage 4 CPT checkpoint from the Beers training pipeline. Image quality and instruction following depend on the prompt, resolution, sampling parameters, and input image. The checkpoint was prepared for CUDA inference with bfloat16 weights.

The 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
45
Safetensors
Model size
5B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Space using ernie-research/Beers-CPT 1

Collection including ernie-research/Beers-CPT

Paper for ernie-research/Beers-CPT