gpustack/stable-diffusion-v3-5-large-GGUF

gpustack
Texto a imagen

Versión GGUF experimental de Stable Diffusion 3.5 Large, un modelo generativo texto-a-imagen MMDiT de Stability AI. Está orientado a generar imágenes desde prompts de texto con mejoras en calidad visual, tipografía, comprensión de prompts complejos y eficiencia de recursos. Esta variante incluye cuantizaciones GGUF para ejecución local, basada en stable-diffusion.cpp con soporte específico de gpustack/llama-box v0.0.75 o superior.

Como usar

Instalación y uso con Diffusers para el repositorio GGUF:

pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline

# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained(
    "gpustack/stable-diffusion-v3-5-large-GGUF",
    dtype=torch.bfloat16,
    device_map="cuda"
)

prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]

Uso de Stable Diffusion 3.5 Large con Diffusers:

pip install -U diffusers
import torch
from diffusers import StableDiffusion3Pipeline

pipe = StableDiffusion3Pipeline.from_pretrained(
    "stabilityai/stable-diffusion-3.5-large",
    torch_dtype=torch.bfloat16
)
pipe = pipe.to("cuda")

image = pipe(
    "A capybara holding a sign that reads Hello World",
    num_inference_steps=28,
    guidance_scale=3.5,
).images[0]

image.save("capybara.png")

Ejemplo de cuantización con bitsandbytes para reducir uso de VRAM:

pip install bitsandbytes
from diffusers import BitsAndBytesConfig, SD3Transformer2DModel
from diffusers import StableDiffusion3Pipeline
import torch

model_id = "stabilityai/stable-diffusion-3.5-large"

nf4_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.bfloat16
)

model_nf4 = SD3Transformer2DModel.from_pretrained(
    model_id,
    subfolder="transformer",
    quantization_config=nf4_config,
    torch_dtype=torch.bfloat16
)

pipeline = StableDiffusion3Pipeline.from_pretrained(
    model_id,
    transformer=model_nf4,
    torch_dtype=torch.bfloat16
)
pipeline.enable_model_cpu_offload()

prompt = "A whimsical and creative image depicting a hybrid creature that is a mix of a waffle and a hippopotamus, basking in a river of melted butter amidst a breakfast-themed landscape. It features the distinctive, bulky body shape of a hippo. However, instead of the usual grey skin, the creature's body resembles a golden-brown, crispy waffle fresh off the griddle. The skin is textured with the familiar grid pattern of a waffle, each square filled with a glistening sheen of syrup. The environment combines the natural habitat of a hippo with elements of a breakfast table setting, a river of warm, melted butter, with oversized utensils or plates peeking out from the lush, pancake-like foliage in the background, a towering pepper mill standing in for a tree. As the sun rises in this fantastical world, it casts a warm, buttery glow over the scene. The creature, content in its butter river, lets out a yawn. Nearby, a flock of birds take flight"

image = pipeline(
    prompt=prompt,
    num_inference_steps=28,
    guidance_scale=4.5,
    max_sequence_length=512,
).images[0]

image.save("whimsical.png")

Funcionalidades

Modelo texto-a-imagen basado en arquitectura Multimodal Diffusion Transformer MMDiT.
Variante GGUF cuantizada para uso local y autoalojado.
Incluye cuantizaciones FP16, Q8_0, Q4_1 y Q4_0 en distintos componentes del modelo.
Usa tres codificadores de texto preentrenados: OpenCLIP ViT-G, CLIP ViT-L y T5-xxl.
Aplica QK-normalization para mejorar la estabilidad del entrenamiento.
Diseñado para mejor adherencia a prompts, calidad estética, tipografía y comprensión de instrucciones complejas.
Compatible con flujos mediante Diffusers, ComfyUI y herramientas locales compatibles.
Licencia Stability AI Community License, con uso gratuito para investigación, uso no comercial y organizaciones o individuos con menos de 1M USD de ingresos anuales.

Casos de uso

Generación de ilustraciones, arte conceptual y piezas visuales a partir de prompts de texto.
Diseño gráfico, exploración visual y procesos creativos asistidos por IA.
Herramientas educativas o creativas que necesiten generación de imágenes local o autoalojada.
Investigación sobre modelos generativos texto-a-imagen y sus limitaciones.
Pruebas de ejecución local con formatos GGUF y cuantizaciones para reducir requisitos de memoria.