Complete Guide to Local Deployment of Stable Diffusion
Why Deploy Stable Diffusion Locally
Midjourney is useful, but it has several critical issues:
- No full control -- what you want to generate may not always work
- No batch generation -- there are speed limits
- Cannot use custom trained models/LoRA
- Generated images have copyright concerns
Deploying Stable Diffusion locally solves all these problems:
- Full complete control -- draw whatever you want
- No unlimited generation -- create as many images as you like
- All models/LoRA freely available
- Completely free, no costs whatsoever
- Full copyright ownership of generated images
This article teaches you local deployment from scratch -- even beginners can follow along.
Hardware Requirements
Minimum Configuration (runs, but slowly)
- GPU: NVIDIA graphics card, 4GB VRAM or more
- RAM: 8GB or more
- Disk: 20GB or more free space
Recommended Configuration (smooth usage)
- GPU: NVIDIA graphics card, 8GB VRAM or more
- RAM: 16GB or more
- Disk: 50GB or more SSD
Perfect Configuration (professional use)
- GPU: NVIDIA graphics card, 12GB VRAM or more
- RAM: 32GB or more
- Disk: 100GB or more NVMe SSD
Important Notes
- Only NVIDIA GPUs are recommended -- AMD and Intel GPUs have poor compatibility
- VRAM is more important than the GPU model itself
- You can also run it on CPU without an N card, but it will be extremely slow
Step 1: Install Git and Python
Install Git
- Download from official site: https://git-scm.com/download/win
- Use default settings throughout installation
- After installation, open cmd and type
git --version. Version number displayed means success.
Install Python
Important: Must be Python 3.10.x -- do not use 3.11 or 3.9
- Download from: https://www.python.org/downloads/release/python-3106/
- Download the Windows Installer (64-bit)
3.During installation, make sure to check "Add Python to PATH" - Use default settings throughout
- After installation, open cmd and type
python --version. Showing 3.10.6 means success.
Step 2: Install WebUI (Automatic1111)
What is WebUI
Automatic1111 is currently the most popular Stable Diffusion graphical interface, with the most complete features and the largest plugin ecosystem.
Installation Steps
- Create a new folder on a drive with sufficient space, e.g.,
D:\SD - Navigate to the folder, type
cmdin the address bar, press Enter - Run the following command to clone the project:
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
- Wait for cloning to complete, enter the
stable-diffusion-webuifolder - Find
webui-user.bat, right-click to edit - Add the following line at the top (required for 8GB VRAM):
set COMMANDLINE_ARGS=--xformers --medvram
Parameters for different VRAM amounts:
| VRAM | Parameters |
|---|---|
| 4GB | --xformers --lowvram |
| 6GB | --xformers --medvram |
| 8GB+ | --xformers |
| 12GB+ | Nothing needed |
-
Save, double-click to run
webui-user.bat -
The first run will automatically download various dependencies -- be patient
-
When you see
Running on local URL: http://127.0.0.1:7860, it means success -
Open this address in your browser to see the interface!
Common Installation Issues
Issue 1: Slow download, errors
Solution: Use a proxy, or switch to a domestic mirror source
Issue 2: Out of VRAM
Solution: Add the --medvram or --lowvram parameter
Issue 3: Various weird errors
Solution:
- Confirm Python version is 3.10.x
- Delete the venv folder and re-run
- Restart your PC and try again
Step 3: Download Models
What is a Model
The model is the AI's brain -- different models excel at different art styles.
Model Download Sites
1.Civitai(highly recommended): https://civitai.com/
- Most complete model library, fastest updates
- Has preview images and example prompts
2.Hugging Face: https://huggingface.co/
- Official models are all here
Recommended Base Models
SD 1.5 Series (best compatibility, most resources)
-Anything V5: Versatile anime
-MeinaMix: Anime, great style
-Realistic Vision: Photorealistic
-Deliberate: Versatile, can generate anything
SDXL Series (newer models, higher quality)
-SDXL Base: Official base model
-RealVis XL: Photorealistic
-Animagine XL: Anime
How to Install Models
- Downloaded model files (.safetensors or .ckpt)
- Place them in the folder:
models\Stable-diffusion\ - Restart WebUI, or click the refresh button in the interface
- You'll see it in the model dropdown in the top-left corner
Step 4: Basic Interface Overview
Main Function Areas
1.Top-left corner: Model selection, refresh button
2.Upper-left tabs:
- txt2img: Text-to-image
- img2img: Image-to-image
- Extras: Upscaling, HD restoration
- PNG Info: View image parameters
- Settings: Settings
- Extensions: Plugins
3.Main txt2img interface:
- Positive prompt input box
- Negative prompt input box
- Parameter settings area
- Generate button
- Results display area
Step 5: Generate Your First Image
Step 1: Select a Model
Choose a model you have downloaded.
Step 2: Enter Prompts
Positive prompt:
masterpiece, best quality, 1girl, black long hair, white dress,
standing in flower field, afternoon sunlight,
cinematic lighting, depth of field, bokeh
Negative prompt(required):
low quality, worst quality, blurry, ugly, deformed,
bad hands, missing fingers, extra fingers, mutated hands,
watermark, text, signature
Step 3: Set Parameters
Sampling method: DPM++ 2M Karras
Sampling steps: 28
CFG scale: 7
Resolution: 512x768
Batch count: 4
Step 4: Click Generate
Wait a few dozen seconds, and you'll see the results!
Step 6: Installing Essential Plugins
How to Install Plugins
- Go to the Extensions tab
- Go to the Available sub-tab
- Click the Load from button
- Search for the plugin name, click Install to install
- Restart WebUI after installation
Essential Plugin Recommendations
1. ControlNet (the most important, bar none)
Precise control of composition, pose, and structure -- essential for advanced users.
2. LoRA Block Weight
Fine-tune LoRA weights -- essential for advanced users.
3. Additional Networks
Easily switch between multiple LoRAs -- recommended for beginners.
4. Ultimate SD Upscale
HD upscaling, batch processing.
Step 7: LoRA Installation and Usage
What is LoRA
Small models used to add specific characters, styles, or concepts to a base model.
LoRA Download
Also available on Civitai, filter by LoRA type.
Installation Method
Place the downloaded .safetensors file into:
models\Lora\
How to Use
Add to your prompt:
<lora:model_filename:weight>
Example:
<lora:gufengV2:0.7>
Weights between 0.6-0.8 generally work best.
Step 8: Troubleshooting Common Issues
Issue 1: Generation too slow
Solution:
- Enable --xformers parameter
- Reduce steps (20-28 is sufficient)
- Lower resolution
Issue 2: Bad hands
Solution:
- Add negative prompts
- Use inpaint to redraw hands separately
- Post-process with CodeFormer
Issue 3: Extra heads/arms
Solution:
- Lower resolution, don't exceed 768
- Use HD fix instead of generating large images directly
- Control with ControlNet
Issue 4: Prompts not taking effect
Solution:
- Put the most important phrases first
- Use parentheses for weighting: ((important content))
- Check if the model supports it
Advanced Learning Path
Week 1: Basic Usage
- Able to generate images normally
- Understand basic prompt writing
- Know how to switch models
Week 2: Parameter Optimization
- Understand what each parameter does
- Master negative prompts
- Know how to use HD fix
Week 3: ControlNet
- Learn to use OpenPose to control poses
- Learn to use Canny to control outlines
- Learn to use Depth to control spatial relationships
Week 4: Advanced Techniques
- Inpainting
- Image-to-image
- Batch processing
- Training your own LoRA
Resource Recommendations
Learning Sites
- Civitai: Download models, check out other people's work
- Reddit r/StableDiffusion: Largest SD community abroad
- Bilibili: Large number of Chinese tutorials
Model Recommendation Sites
- Civitai.com (first choice)
- HuggingFace.co
Conclusion
Local deployment of Stable Diffusion looks complicated, but it's actually quite simple.
Just follow this tutorial step by step, and even beginners can succeed.
Deployment is only the beginning -- real learning is just getting started.
But it's all worth it.
When you can fully control the AI and draw whatever you want,
you'll discover: this is the true magic of AI art.
Start now, follow the tutorial step by step.
Look things up when you have questions, and learn by solving problems.
In less than a month, you too can become the AI art expert that others look up to.
Alternative WebUI Options
While Automatic1111 is the most popular choice, several alternative WebUIs are worth considering depending on your needs.
ComfyUI takes a node-based approach to image generation. Instead of a traditional form-based interface, you connect processing nodes in a visual pipeline. The learning curve is steeper, but the flexibility is unmatched. Complex workflows can be saved as templates, making it ideal for production pipelines where consistency matters.
Fooocus focuses on simplicity. It hides most parameters behind sensible defaults and produces high-quality results with minimal configuration. If you find Automatic1111's interface overwhelming, Fooocus is an excellent starting point.
Forge is a fork of Automatic1111 that optimizes memory usage, making it possible to run SDXL models on GPUs with as little as 4GB of VRAM. If you're hardware-limited, Forge is worth trying.
Cloud Deployment Alternatives
If your local hardware isn't sufficient, several cloud platforms offer Stable Diffusion access:
- Google Colab offers free GPU access suitable for running Stable Diffusion, with paid tiers for longer sessions and more powerful GPUs
- RunPod provides on-demand GPU instances at hourly rates, useful for batch generation without owning powerful hardware
- Mage.space and DreamStudio offer subscription-based AI art generation with their own custom models
Cloud deployment removes hardware concerns but introduces ongoing costs and privacy considerations. For occasional use, free tiers are sufficient. For heavy use, local deployment is more economical long-term.
