stable-diffusion.cpp/docs/models/ernie_image.md

4.3 KiB

ERNIE-Image

ERNIE-Image and ERNIE-Image-Turbo generate images from text using the FLUX.2 VAE and a Ministral 3 3B text encoder.

You can run ERNIE-Image with stable-diffusion.cpp on GPUs with 4GB of VRAM — or even less.

Model files

Component Weights and downloads CLI option Requirement
ERNIE-Image-Turbo Safetensors
GGUF
--diffusion-model Choose Turbo or Base
ERNIE-Image Safetensors
GGUF
--diffusion-model Choose Turbo or Base
FLUX.2 VAE Safetensors --vae Required for these examples
Ministral 3 3B text encoder Safetensors
GGUF
--llm Required

Usage

Web UI

Follow the Web UI guide to start the server, then select the recipe matching your weights. Fill the component slots below and click Load models. Use the files and compatibility requirements in Model files.

Recipe Component slots
ERNIE Image Turbo (ernie-image-turbo) diffusion_model, llm, vae, tae
ERNIE Image (ernie-image) diffusion_model, llm, vae, tae

Slot IDs correspond to CLI component options: diffusion_model uses --diffusion-model, llm uses --llm, and model uses -m / --model. Select optional components when required by your checkpoint or task.

DGL

Example Description
ERNIE-Image Turbo Text-to-image generation.
ERNIE-Image Text-to-image generation.

Run a script

Edit paths, prompts and settings in the script's var block, then run from the build directory. Paths inside the script resolve from the working directory.

Windows (PowerShell)

.\bin\Release\sd-cli.exe -M dgl --script ..\docs\dgl\ernie_image\ernie-image-turbo-txt2img.dgl

Linux/macOS

./bin/sd-cli -M dgl --script ../docs/dgl/ernie_image/ernie-image-turbo-txt2img.dgl

Choose another script from the table to run a different task. Add --check to validate syntax and types without loading weights. See the shared run instructions for build paths and the server's file-access rules.

Legacy CLI

CLI examples use the shared path and shell conventions.

ERNIE-Image-Turbo

Windows (PowerShell)

.\bin\Release\sd-cli.exe `
  --diffusion-model ..\models\diffusion_models\ernie-image-turbo.safetensors `
  --vae ..\models\vae\flux2_ae.safetensors `
  --llm ..\models\text_encoders\ministral-3-3b.safetensors `
  -p "a lovely cat" `
  --cfg-scale 1.0 `
  --steps 8 `
  --offload-to-cpu `
  -v

Linux/macOS

./bin/sd-cli \
  --diffusion-model ../models/diffusion_models/ernie-image-turbo.safetensors \
  --vae ../models/vae/flux2_ae.safetensors \
  --llm ../models/text_encoders/ministral-3-3b.safetensors \
  -p "a lovely cat" \
  --cfg-scale 1.0 \
  --steps 8 \
  --offload-to-cpu \
  -v
ERNIE-Image Turbo example

ERNIE-Image

Windows (PowerShell)

.\bin\Release\sd-cli.exe `
  --diffusion-model ..\models\diffusion_models\ernie-image-UD-Q4_K_M.gguf `
  --vae ..\models\vae\flux2_ae.safetensors `
  --llm ..\models\text_encoders\ministral-3-3b.safetensors `
  -p "a lovely cat" `
  --cfg-scale 5.0 `
  --offload-to-cpu `
  -v

Linux/macOS

./bin/sd-cli \
  --diffusion-model ../models/diffusion_models/ernie-image-UD-Q4_K_M.gguf \
  --vae ../models/vae/flux2_ae.safetensors \
  --llm ../models/text_encoders/ministral-3-3b.safetensors \
  -p "a lovely cat" \
  --cfg-scale 5.0 \
  --offload-to-cpu \
  -v
ERNIE-Image example