stable-diffusion-image-generation

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

14|5|Updated Apr 9, 2026
One-click install
npx skills add https://github.com/MLT-OSS/hermes-agent-go --skill stable-diffusion-image-generation-mlt-oss
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stable-diffusion-image-generation
Source: https://github.com/MLT-OSS/hermes-agent-go/tree/main/skills/mlops/models/stable-diffusion
Command: npx skills add https://github.com/MLT-OSS/hermes-agent-go --skill stable-diffusion-image-generation-mlt-oss

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Setting up Stable Diffusion image generation involves navigating many pipelines, schedulers, memory constraints, and model variants, which is error-prone without clear guidance. ## 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 tunable guidance and steps. - Image Transformation: Perform image-to-image translation, inpainting of masked regions, and ControlNet-conditioned generation with edges, poses, or depth maps. - LoRA and Memory Optimization: Load LoRA style adapters, enable CPU offloading, attention slicing, and xFormers to run on limited GPU memory. - Use Case: A developer building a content pipeline needs to generate 1024x1024 product mockups on a single GPU; this Skill provides the SDXL setup, scheduler swap, and memory optimization code to do it. ## Quick Start Ask the agent to generate an image from a text prompt using Stable Diffusion with the Diffusers library and save it as a PNG file.

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 memory needs, SDXL produces higher-quality 1024x1024 images, and Flux is a newer transformer-based model. Diffusers provides dedicated pipeline classes for each, all sharing the same calling pattern.

How do I fix CUDA out of memory errors in Diffusers?

Enable model CPU offloading with pipe.enable_model_cpu_offload(), add attention slicing, and use float16 precision. For large images, also enable VAE slicing and tiling, or reduce batch size and image dimensions.

Can I use ControlNet with Stable Diffusion for pose control?

Yes, load a ControlNetModel such as the openpose or canny variant and pass it to StableDiffusionControlNetPipeline. Provide a preprocessed control image alongside your prompt to condition the generation on structure, pose, or depth.

How do I load LoRA weights into a Diffusers pipeline?

Call pipe.load_lora_weights() with the LoRA path and weight file name, then optionally fuse with pipe.fuse_lora(lora_scale=0.8). Multiple LoRAs can be combined using adapter names and pipe.set_adapters() with per-adapter weights.

Why are my Stable Diffusion outputs black or noisy?

Black images often come from the safety checker or VAE dtype mismatches; try disabling the safety checker and keeping the VAE in float32. Noisy outputs usually mean too few inference steps or a misconfigured scheduler.