stable-diffusion-image-generation

Generate images from text prompts using Stable Diffusion models via HuggingFace Diffusers.

13.0k|930|Updated Nov 3, 2025
One-click install
npx skills add https://github.com/Orchestra-Research/AI-research-SKILLs --skill stable-diffusion-image-generation-orchestra-research
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: stable-diffusion-image-generation
Source: https://github.com/Orchestra-Research/AI-research-SKILLs/tree/main/18-multimodal/stable-diffusion
Command: npx skills add https://github.com/Orchestra-Research/AI-research-SKILLs --skill stable-diffusion-image-generation-orchestra-research

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires diffusers, transformers, accelerate, torch, and includes references (resource) components.

What problem does it solve? Generating images from text descriptions, transforming existing images, and filling masked regions requires deep knowledge of diffusion model pipelines, schedulers, and GPU memory management. This Skill provides ready-to-use guidance and code patterns for the full Stable Diffusion workflow with HuggingFace Diffusers. ## Core Features & Use Cases - Text-to-Image Generation: Create images from natural language prompts using SD 1.5, SDXL, SD 3.0, or Flux models with configurable schedulers and guidance scales. - Image-to-Image, Inpainting & ControlNet: Transform existing images, fill masked regions, and add spatial conditioning via edge maps, poses, or depth. - LoRA, Memory Optimization & Deployment: Load LoRA adapters, apply CPU offloading and attention slicing for limited VRAM, and deploy with FastAPI, Docker, or Kubernetes. - Use Case: A developer building an image generation API can load SDXL with DPM-Solver, enable model CPU offload to fit on a single GPU, and serve reproducible generations with seeded FastAPI endpoints. ## Quick Start Use the stable diffusion skill to generate a 1024x1024 image of a futuristic city with cinematic lighting using SDXL and save it as output.png.

Frequently Asked Questions about stable-diffusion-image-generation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate images from text with Stable Diffusion in Python?▼

Load a DiffusionPipeline from a pretrained model like stable-diffusion-v1-5 with torch.float16, move it to CUDA, then call it with a prompt, num_inference_steps, and guidance_scale. The returned images list contains PIL images you can save directly.

What is the difference between SD 1.5, SDXL, and Flux pipelines?▼

SD 1.5 generates 512x512 images with lower VRAM needs, SDXL produces higher quality 1024x1024 outputs, and Flux uses newer transformer-based architectures. Diffusers auto-detects the model type when loading with DiffusionPipeline.from_pretrained.

How to fix CUDA out of memory errors in Diffusers?▼

Enable model CPU offloading with pipe.enable_model_cpu_offload(), add attention slicing and VAE slicing, or load the model in float16 precision. For large images, enable VAE tiling to decode latents in smaller chunks.

Does Stable Diffusion support LoRA fine-tuning adapters?▼

Yes, load LoRA weights with pipe.load_lora_weights() and adjust strength via fuse_lora with a lora_scale parameter. Multiple LoRAs can be combined using set_adapters with individual adapter weights.

Why are my generated images black or pure noise?▼

Black images often come from the safety checker or VAE dtype mismatches, so disable the safety checker or keep the VAE in float32. Noise outputs usually mean too few inference steps or a misconfigured scheduler.

How do I make Stable Diffusion generation faster?▼

Swap to DPMSolverMultistepScheduler and reduce steps to 20, or use LCMScheduler with the LCM LoRA for 4-step generation. Enabling xFormers memory-efficient attention and torch.compile also speeds up inference.