stable-diffusion-image-generation
यह क्या करती है
यह स्किल Stable Diffusion मॉडलों से छवियाँ बनाने और संपादित करने का तरीका समझाती है। यह उन क्रिएटर्स और डेवलपर्स के लिए है जो कोड से तस्वीरें बनाना या बदलना चाहते हैं।
कब इस्तेमाल करें
- ✓जब आप लिखे विवरण से एक छवि बनाना चाहते हैं।
- ✓जब आप टेक्स्ट prompt से किसी मौजूदा तस्वीर की शैली बदलना चाहते हैं।
- ✓जब आपको किसी तस्वीर के mask वाले हिस्से को भरना है या छवि को किनारों से आगे बढ़ाना है।
Skill का लिंक
https://github.com/Orchestra-Research/AI-Research-SKILLs/blob/main/18-multimodal/stable-diffusion/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरे विवरण से सूर्यास्त के समय एक दीपघर की वॉटरकलर शैली की तस्वीर बनाइए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
आप Diffusers लाइब्रेरी से एक pipeline लोड करते हैं और टेक्स्ट prompt देते हैं। मॉडल शोर से शुरू करता है और उसे चरण-दर-चरण एक छवि में सुधारता है। स्किल image-to-image, inpainting और LoRA शैलियों को भी कवर करती है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Stable Diffusion Image Generation
Comprehensive guide to generating images with Stable Diffusion using the HuggingFace Diffusers library.
When to use Stable Diffusion
Use Stable Diffusion when:
- Generating images from text descriptions
- Performing image-to-image translation (style transfer, enhancement)
- Inpainting (filling in masked regions)
- Outpainting (extending images beyond boundaries)
- Creating variations of existing images
- Building custom image generation workflows
Key features:
- Text-to-Image: Generate images from natural language prompts
- Image-to-Image: Transform existing images with text guidance
- Inpainting: Fill masked regions with context-aware content
- ControlNet: Add spatial conditioning (edges, poses, depth)
- LoRA Support: Efficient fine-tuning and style adaptation
- Multiple Models: SD 1.5, SDXL, SD 3.0, Flux support
Use alternatives instead:
- DALL-E 3: For API-based generation without GPU
- Midjourney: For artistic, stylized outputs
- Imagen: For Google Cloud integration
- Leonardo.ai: For web-based creative workflows
Quick start
Installation
pip install diffusers transformers accelerate torch
pip install xformers # Optional: memory-efficient attention
Basic text-to-image
from diffusers import DiffusionPipeline
import torch
# Load pipeline (auto-detects model type)
pipe = DiffusionPipeline.from_pretrained(
"stable-diffusion-v1-5/stable-diffusion-v1-5",
torch_dtype=torch.float16
)
pipe.to("cuda")
# Generate image
image = pipe(
"A serene mountain landscape at sunset, highly detailed",
num_inference_steps=50,
guidance_scale=7.5
).images[0]
image.save("output.png")
Using SDXL (higher quality)
from diffusers import AutoPipelineForText2Image
import torch
pipe = AutoPipelineForText2Image.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
torch_dtype=torch.float16,
variant="fp16"
)
pipe.to("cuda")
# Enable memory optimization
pipe.enable_model_cpu_offload()
image = pipe(
prompt="A futuristic city with flying cars, cinematic lighting",
height=1024,
width=1024,
num_inference_steps=30
).images[0]
Architecture overview
Three-pillar design
Diffusers is built around three core components:
Pipeline (orchestration)
├── Model (neural networks)
│ ├── UNet / Transformer (noise prediction)
│ ├── VAE (latent encoding/decoding)
│ └── Text Encoder (CLIP/T5)
└── Scheduler (denoising algorithm)
Pipeline inference flow
Text Prompt → Text Encoder → Text Embeddings
↓
Random Noise → [Denoising Loop] ← Scheduler
↓
Predicted Noise
↓
VAE Decoder → Final Image
Core concepts
Pipelines
Pipelines orchestrate complete workflows:
| Pipeline | Purpose |
|---|---|
StableDiffusionPipeline |
Text-to-image (SD 1.x/2.x) |
StableDiffusionXLPipeline |
Text-to-image (SDXL) |
StableDiffusion3Pipeline |
Text-to-image (SD 3.0) |
FluxPipeline |
Text-to-image (Flux models) |
StableDiffusionImg2ImgPipeline |
Image-to-image |
StableDiffusionInpaintPipeline |
Inpainting |
Schedulers
Schedulers control the denoising process:
| Scheduler | Steps | Quality | Use Case |
|---|---|---|---|
EulerDiscreteScheduler |
20-50 | Good | Default choice |
EulerAncestralDiscreteScheduler |
20-50 | Good | More variation |
DPMSolverMultistepScheduler |
15-25 | Excellent | Fast, high quality |
DDIMScheduler |
50-100 | Good | Deterministic |
LCMScheduler |
4-8 | Good | Very fast |
UniPCMultistepScheduler |
15-25 | Excellent | Fast convergence |
Swapping schedulers
from diffusers import DPMSolverMultistepScheduler
# Swap for faster generation
pipe.scheduler = DPMSolverMultistepScheduler.from_config(
pipe.scheduler.config
)
# Now generate with fewer steps
image = pipe(prompt, num_inference_steps=20).images[0]
Generation parameters
Key parameters
| Parameter | Default | Description |
|---|---|---|
prompt |
Required | Text description of desired image |
negative_prompt |
None | What to avoid in the image |
num_inference_steps |
50 | Denoising steps (more = better quality) |
guidance_scale |
7.5 | Prompt adherence (7-12 typical) |
height, width |
512/ |
अक्सर पूछे जाने वाले सवाल
इसे क्या इंस्टॉल करना होगा?
pip install diffusers transformers accelerate torch चलाइए, और xformers वैकल्पिक जोड़ सकते हैं।
यह कौन से मॉडल सपोर्ट करता है?
स्किल SD 1.5, SDXL, SD 3.0 और Flux की सूची देती है।
कोई खास शैली कैसे जोड़ूँ?
स्किल कुशल शैली अनुकूलन के लिए LoRA सपोर्ट का ज़िक्र करती है।
जानकारी
लेखक का मूल विवरण
State-of-the-art text-to-image generation with Stable Diffusion models via HuggingFace Diffusers. Use when generating images from text prompts, performing image-to-image translation, inpainting, or building custom diffusion pipelines.
लोकप्रियता
- GitHub स्टार
- 14k
- रैंकिंग में स्थान
- #11237
- लाइसेंस
- MIT
- अपडेट की गई
- 10/10/2026
कमेंट
- …
इस repository की और skills
autoresearch
14kयह आपके एजेंट को साहित्य समीक्षा से प्रयोग और लेखन तक पूरे AI रिसर्च प्रोजेक्ट में मार्गदर्शन देती है, परीक्षण और समीक्षा के दोहराने वाले चक्र के साथ।
prompt-guard
14kयह आपके एजेंट को Meta के छोटे classifier से टेक्स्ट को AI ऐप तक पहुँचने से पहले prompt injection और jailbreak कोशिशों के लिए जाँचने देती है।
pytorch-fsdp2
14kयह आपके एजेंट को दिखाती है कि ट्रेनिंग स्क्रिप्ट में PyTorch FSDP2 कैसे जोड़ें, ताकि बड़े मॉडल GPU पर बँटें और सही तरीके से सेव हों।
ml-training-recipes
14kयह आपके एजेंट को न्यूरल नेटवर्क के लिए परखे हुए ट्रेनिंग तरीके देती है, जिनमें मॉडल चुनाव, optimizers, learning rates और loss spikes ठीक करना शामिल है।
मिलती-जुलती skills
gifgrep
394kयह आपके एजेंट को GIF लाइब्रेरी में खोजने, नतीजों का पूर्वावलोकन करने, GIF डाउनलोड करने, और उससे एक फ़्रेम या फ़्रेम्स की शीट निकालने देती है।
meme-maker
394kयह आपके एजेंट को मीम टेम्पलेट चुनने, अपने कैप्शन जोड़ने और मीम को SVG या PNG इमेज के रूप में बनाने देती है।
ios-icon-gen
280kआपके एजेंट को iOS ऐप्स के लिए icons बनाने देता है। यह Apple symbols या दूसरे स्रोतों के आइकन इस्तेमाल करके सही files बनाता है।