← Back to docs

Recipe

Diffusers library primer

The Hugging Face diffusers library is the canonical Python interface for running and fine-tuning diffusion models. This primer walks through installing it, loading a pipeline, and generating your first image against the Meridian gateway.

1. Install

Install diffusers alongside transformers and accelerate. Meridian routes image jobs through an OpenAI-compatible shim, so the standard SDK works without modification.

pip install diffusers transformers accelerate
pip install --upgrade openai

2. Load a pipeline

Pipelines bundle the scheduler, UNet, VAE, and tokenizer into one callable object. For SDXL-class workloads, keep the model in float16 on a CUDA device and enable attention slicing to fit within 8 GB of VRAM.

3. Generate via Meridian

For hosted inference, skip local weights and call llm.getnimbus.net with your gateway key. The same prompt, scheduler hints, and seed pass through unchanged, so you can prototype locally and ship to the gateway without rewriting the call site.