<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://serverrental.store/index.php?action=history&amp;feed=atom&amp;title=Running_Stable_Diffusion_on_GPU_Server</id>
	<title>Running Stable Diffusion on GPU Server - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://serverrental.store/index.php?action=history&amp;feed=atom&amp;title=Running_Stable_Diffusion_on_GPU_Server"/>
	<link rel="alternate" type="text/html" href="https://serverrental.store/index.php?title=Running_Stable_Diffusion_on_GPU_Server&amp;action=history"/>
	<updated>2026-04-14T23:04:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://serverrental.store/index.php?title=Running_Stable_Diffusion_on_GPU_Server&amp;diff=5735&amp;oldid=prev</id>
		<title>Admin: New server guide</title>
		<link rel="alternate" type="text/html" href="https://serverrental.store/index.php?title=Running_Stable_Diffusion_on_GPU_Server&amp;diff=5735&amp;oldid=prev"/>
		<updated>2026-04-12T15:56:31Z</updated>

		<summary type="html">&lt;p&gt;New server guide&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Running Stable Diffusion on a GPU Server =&lt;br /&gt;
&lt;br /&gt;
This guide provides a comprehensive walkthrough for setting up and running Stable Diffusion on a Linux-based GPU server. We will cover installation, VRAM requirements, and optimization techniques to ensure a smooth and efficient experience.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
Before you begin, ensure you have the following:&lt;br /&gt;
&lt;br /&gt;
* '''A Linux Server with a Compatible GPU:''' NVIDIA GPUs are highly recommended due to CUDA support. Ensure your GPU has sufficient VRAM (see VRAM Requirements section). You can find powerful GPU servers at [https://en.immers.cloud/signup/r/20241007-8310688-334/ Immers Cloud], with options starting from $0.23/hr for inference.&lt;br /&gt;
* '''SSH Access:''' You'll need to connect to your server via SSH.&lt;br /&gt;
* '''Basic Linux Command-Line Proficiency:''' Familiarity with commands like `cd`, `ls`, `sudo`, `apt`, and `git`.&lt;br /&gt;
* '''NVIDIA Drivers Installed:''' Ensure the correct NVIDIA drivers are installed and functioning. You can check this by running:&lt;br /&gt;
&amp;lt;pre&amp;gt;nvidia-smi&amp;lt;/pre&amp;gt;&lt;br /&gt;
If this command doesn't show your GPU information, you'll need to install the drivers first. Refer to your Linux distribution's documentation or NVIDIA's official website for installation instructions.&lt;br /&gt;
* '''NVIDIA Container Toolkit (Recommended):''' For easier management and isolation, especially if you plan to run multiple AI models, installing the NVIDIA Container Toolkit is highly recommended. This allows Docker containers to access your GPU.&lt;br /&gt;
** Installation instructions can be found on the official NVIDIA Container Toolkit documentation.&lt;br /&gt;
&lt;br /&gt;
== Understanding VRAM Requirements ==&lt;br /&gt;
Stable Diffusion's VRAM (Video Random Access Memory) requirements depend largely on the model size, resolution of generated images, and batch size.&lt;br /&gt;
&lt;br /&gt;
* '''Minimum (1024x1024, small batch size):''' 6GB - 8GB VRAM is generally the minimum for basic image generation at standard resolutions. Performance might be slow.&lt;br /&gt;
* '''Recommended (1024x1024, moderate batch size):''' 10GB - 12GB VRAM offers a good balance of performance and capability for most users.&lt;br /&gt;
* '''High-End (Larger resolutions, larger batch sizes, advanced features):''' 16GB VRAM or more is ideal for generating higher resolution images, using larger models, or running multiple processes concurrently.&lt;br /&gt;
&lt;br /&gt;
For demanding tasks, consider renting a dedicated GPU server from providers like [https://en.immers.cloud/signup/r/20241007-8310688-334/ Immers Cloud], which offers a range of GPUs from consumer-grade to enterprise-level H200s.&lt;br /&gt;
&lt;br /&gt;
== Installation Steps ==&lt;br /&gt;
&lt;br /&gt;
This guide will focus on installing Stable Diffusion via AUTOMATIC1111's Stable Diffusion Web UI, a popular and feature-rich interface.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Install Python and Git ===&lt;br /&gt;
Ensure you have Python 3.10.6 and Git installed. If not, you can install them using your distribution's package manager. For Debian/Ubuntu-based systems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt update&lt;br /&gt;
sudo apt install python3 python3-venv git -y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Clone the Stable Diffusion Web UI Repository ===&lt;br /&gt;
Create a directory for your Stable Diffusion installation and clone the repository:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git&lt;br /&gt;
cd stable-diffusion-webui&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Download Stable Diffusion Models ===&lt;br /&gt;
You need to download the Stable Diffusion model checkpoints (files ending in `.ckpt` or `.safetensors`). The most common ones are SD v1.5 and SDXL.&lt;br /&gt;
&lt;br /&gt;
* '''SD v1.5:''' You can download it from Hugging Face. A common source is the official Stable Diffusion v1-5 checkpoint.&lt;br /&gt;
* '''SDXL:''' This is a more powerful model. Download the base and refiner models.&lt;br /&gt;
&lt;br /&gt;
Place the downloaded model files into the `stable-diffusion-webui/models/Stable-diffusion` directory. If the directory doesn't exist, create it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p models/Stable-diffusion&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can typically find download links for these models on Hugging Face (e.g., search for &amp;quot;runwayml/stable-diffusion-v1-5&amp;quot; or &amp;quot;stabilityai/stable-diffusion-xl-base-1.0&amp;quot;). After downloading, move the `.ckpt` or `.safetensors` files into the `models/Stable-diffusion` folder.&lt;br /&gt;
&lt;br /&gt;
=== Step 4: Configure the Web UI Script ===&lt;br /&gt;
The `webui-user.sh` script is used to launch the Stable Diffusion Web UI. You can modify it to set specific environment variables or command-line arguments.&lt;br /&gt;
&lt;br /&gt;
Edit the `webui-user.sh` file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano webui-user.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the line that starts with `export COMMANDLINE_ARGS=` and uncomment it. You can add arguments here to control performance and features. Some useful arguments include:&lt;br /&gt;
&lt;br /&gt;
* '''`--xformers`''': Enables xformers memory-efficient attention, which can significantly speed up generation and reduce VRAM usage. Highly recommended if supported by your GPU.&lt;br /&gt;
* '''`--medvram`''': Optimizes for systems with medium VRAM (e.g., 8-12GB).&lt;br /&gt;
* '''`--lowvram`''': Optimizes for systems with low VRAM (e.g., 4-6GB), but will be significantly slower.&lt;br /&gt;
* '''`--no-half`''': Disables automatic mixed precision. Might be necessary on some older GPUs or if you encounter errors, but will increase VRAM usage.&lt;br /&gt;
* '''`--listen`''': Allows access from other machines on your network. Be cautious with this on public networks.&lt;br /&gt;
&lt;br /&gt;
A good starting configuration for a server with 10GB+ VRAM would be:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export COMMANDLINE_ARGS=&amp;quot;--xformers --listen&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For servers with less VRAM (e.g., 8GB), you might try:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export COMMANDLINE_ARGS=&amp;quot;--xformers --medvram --listen&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the editor (Ctrl+X, Y, Enter in nano).&lt;br /&gt;
&lt;br /&gt;
=== Step 5: Launch Stable Diffusion ===&lt;br /&gt;
Now, run the launch script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bash webui-user.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first time you run this, it will download and install all necessary Python dependencies. This can take a considerable amount of time. Subsequent launches will be much faster.&lt;br /&gt;
&lt;br /&gt;
Once the dependencies are installed and the server is ready, you will see a message indicating that the web UI is running and providing a URL, typically:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Running on local URL: http://127.0.0.1:7860&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you used the `--listen` argument, you can access it from your local machine's browser by navigating to `&amp;lt;your_server_ip&amp;gt;:7860`. For example: `http://192.168.1.x:7860`.&lt;br /&gt;
&lt;br /&gt;
== Optimization Tips ==&lt;br /&gt;
&lt;br /&gt;
* '''Use `--xformers`''': As mentioned, this is one of the most effective ways to improve speed and reduce VRAM usage.&lt;br /&gt;
* '''Select Smaller Models:''' If you're struggling with VRAM, try using smaller or older Stable Diffusion checkpoints.&lt;br /&gt;
* '''Reduce Resolution and Batch Size:''' Lowering the output image resolution and the number of images generated per batch (batch size) will significantly decrease VRAM demands.&lt;br /&gt;
* '''Close Unnecessary Applications:''' Ensure no other GPU-intensive applications are running on the server.&lt;br /&gt;
* '''Monitor VRAM Usage:''' Use `nvidia-smi` periodically to check your VRAM consumption.&lt;br /&gt;
* '''Consider SDXL Turbo or LCM Models:''' For faster inference, explore specialized models like SDXL Turbo or Latent Consistency Models (LCMs), which are designed for rapid image generation.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
* '''`CUDA out of memory` Error:'''&lt;br /&gt;
    * '''Solution:''' Try using `--medvram` or `--lowvram` arguments in `webui-user.sh`. Reduce image resolution and batch size. Close other GPU-intensive applications. If using SDXL, try switching to SD v1.5.&lt;br /&gt;
* '''Slow Generation Speed:'''&lt;br /&gt;
    * '''Solution:''' Ensure `--xformers` is enabled. Check if your GPU drivers are up-to-date. Consider upgrading your server's GPU if performance is consistently poor.&lt;br /&gt;
* '''Web UI Not Accessible:'''&lt;br /&gt;
    * '''Solution:''' Verify that the `--listen` argument is present in `webui-user.sh` if you're trying to access it from another machine. Check your server's firewall to ensure port 7860 is open.&lt;br /&gt;
* '''Dependencies Not Installing:'''&lt;br /&gt;
    * '''Solution:''' Ensure you have a stable internet connection. Check for any specific error messages during the installation process and search online for solutions related to those errors.&lt;br /&gt;
&lt;br /&gt;
== Related Articles ==&lt;br /&gt;
* [[Linux Server Administration]]&lt;br /&gt;
* [[NVIDIA GPU Setup]]&lt;br /&gt;
* [[Docker on Linux]]&lt;br /&gt;
&lt;br /&gt;
[[Category:AI and GPU]]&lt;br /&gt;
[[Category:Server Administration]]&lt;br /&gt;
[[Category:Stable Diffusion]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>