Skip to content
Courses/Generative AI: image, voice and video/Reproducible Diffusers with Python

Reproducible Diffusers with Python

When an image is part of a course, campaign, or product, you need to reproduce it, compare it, and document it. That's where Diffusers wins: it turns generation into versionable code.

  • Create a minimal image generation script.
  • Control seed, size, steps, and output filename.
  • Save a manifest to audit results.

Environment

Terminal
mkdir imagenes-diffusers
cd imagenes-diffusers
python -m venv .venv
source .venv/bin/activate
pip install -U diffusers transformers accelerate sentencepiece safetensors

Base script

Terminal
import json
import torch
from diffusers import FluxPipeline

model_id = "black-forest-labs/FLUX.1-schnell"
prompt = "clear educational diagram about local AI, calm workspace, Spanish labels, no logos"
seed = 2048

pipe = FluxPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
pipe.enable_model_cpu_offload()

image = pipe(
    prompt,
    num_inference_steps=4,
    guidance_scale=0.0,
    generator=torch.Generator("cpu").manual_seed(seed),
).images[0]

image.save("salida-local-ai-2048.png")

manifest = {
    "model_id": model_id,
    "prompt": prompt,
    "seed": seed,
    "steps": 4,
    "guidance_scale": 0.0,
    "output": "salida-local-ai-2048.png",
}

with open("salida-local-ai-2048.manifest.json", "w", encoding="utf-8") as f:
    json.dump(manifest, f, ensure_ascii=False, indent=2)
Complete Aulafy mapSee how this lesson fits without leaving your path.

Complete Aulafy map

How all courses connect

This is not a checklist. Start with the foundation, choose an outcome, and go deeper only when your project needs more control.

  1. 1Understand
  2. 2Apply or build
  3. 3Operate with confidence
01

Choose an application

Turn the foundation into a visible outcome: a website, a business improvement, media, or an interactive experience.

Continue into the technical branch when you need to maintain code, data, or infrastructure.

02

Build with code

Prepare your environment, work with coding agents, and run models while keeping control of your projects.

This branch prepares you to design and operate reliable AI systems.

03

Take systems to production

Combine retrieval, agents, evaluation, security, deployment, and model adaptation when the problem requires it.

You do not need every course: choose the component your system needs and return as it grows.

View full catalogue