Running Stable Diffusion on a Rented GPU Server
A rented GPU that looked cheap on the hourly listing cost me more than expected: I left it running overnight after the first image finished. The model took minutes to load, but the idle machine kept billing for hours. This walkthrough covers choosing a GPU, setting up Stable Diffusion on Ubuntu, connecting securely, and avoiding that kind of surprise.
Choose a server that fits the model
For a first run, an NVIDIA GPU with 8 GB of VRAM is a reasonable target for Stable Diffusion 1.5. SDXL is more comfortable with 12 GB or more, though actual requirements depend on resolution, batch size, and optimizations. Check the GPU model and VRAM before renting; a listing’s “GPU memory” and its system RAM are different things.
Disk space matters too. I’d start with at least 50 GB of persistent storage for the operating system, Python dependencies, model checkpoints, and generated images. More is useful if you plan to keep multiple models.
Vast.ai is a good option I’ve used and tested for on-demand GPU rentals, with a range of hardware and prices. PowerVPS is another provider I’ve used and tested for VPS workloads; check its current offerings if you need a longer-lived server or supporting services, and confirm GPU availability before choosing a plan. In either case, compare the total cost, including storage and any charges that continue when the GPU is idle. The Server Rental Guide is a useful resource when comparing rental options and terms.
Start with a clean Ubuntu server
Choose an Ubuntu 22.04 image with NVIDIA drivers already installed if the provider offers one. That avoids spending your first session debugging driver setup. After connecting over SSH, confirm the GPU is visible:
nvidia-smi
You should see the GPU model, driver version, and memory. If the command is missing or reports no devices, check the provider’s GPU image and driver instructions before installing anything else. Driver installation varies by image and provider.
Install the basic tools:
sudo apt update
sudo apt install -y git python3 python3-venv python3-pip
For this example, use AUTOMATIC1111’s Stable Diffusion WebUI. Its first startup installs Python dependencies, so allow time for that, and keep the server’s disk persistent if you want to reuse the installation.
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
You’ll need a model checkpoint that you’re allowed to use. Download it through the model host’s normal process, then copy it to the server or download it from the server if the host provides a direct link. Some model hosts require accepting a license or signing in. Put the .safetensors file in the WebUI’s model directory:
mkdir -p models/Stable-diffusion
# Copy your checkpoint into models/Stable-diffusion/
For example, from your local computer, copy a file with scp:
scp ./my-model.safetensors USER@HOST:stable-diffusion-webui/models/Stable-diffusion/
Replace USER and HOST with the SSH login details supplied by your provider. This command assumes the clone is in the remote user’s home directory.
Launch it without exposing the UI publicly
Start the WebUI so it listens on the server’s network interfaces:
./webui.sh --listen --port 7860
Keep this process running in your SSH session for the first test. The UI does not require you to open port 7860 to the internet. Instead, keep the provider firewall or security group closed to inbound traffic on that port and create a tunnel from your local machine:
ssh -L 7860:127.0.0.1:7860 USER@HOST
Then open http://127.0.0.1:7860 in your local browser. The tunnel forwards your local port to the WebUI on the server. If port 7860 is already in use locally, choose another local port, for example:
ssh -L 7861:127.0.0.1:7860 USER@HOST
In that case, open http://127.0.0.1:7861. Avoid exposing an unauthenticated image-generation UI directly to the public internet.
Generate a first image and check utilization
Select the checkpoint in the UI, enter a prompt, and start with a modest configuration: 512×512 resolution, one image, and around 20 steps. Once that works, try larger resolutions or other settings.
Watch GPU usage in a second SSH session:
nvidia-smi
A GPU that appears underutilized may be waiting on model loading, disk access, or a setting that sends work to the CPU. Don’t assume a higher step count is always better; it increases generation time, and the visual difference depends on the prompt and sampler.
Two rental habits that save trouble
Keep models on persistent storage. Many rental platforms distinguish between stopping a machine and deleting it. A stopped instance may retain its disk; deleting it may remove the model files too. Check the provider’s rules before you end a session, and copy anything important off the server.
Treat the hourly rate as only part of the cost. A GPU with more VRAM may finish a job faster, but the cheapest listing is not automatically the cheapest run. For a short task, compare estimated runtime as well as hourly price. Also check whether persistent disks are billed while the GPU is stopped. The details vary by provider and rental type.
Shut down when you’re done
Stop the WebUI with Ctrl+C in its SSH session. Then stop or release the rented instance using the provider’s controls. Don’t assume closing SSH stops the server. On some platforms, the machine keeps running—and billing—until you explicitly stop or terminate it.
If you expect to return later, choose the option that preserves the disk and confirm its storage charges. If you no longer need the files, back up the outputs and remove the instance according to the provider’s instructions.
Summary
A rented GPU makes Stable Diffusion accessible without buying hardware, but the setup is only half the job: model storage, network access, and shutdown behavior all affect the experience and the bill. Start with a preconfigured Ubuntu GPU image, verify it with nvidia-smi, use a model you’re licensed to run, and access the WebUI through an SSH tunnel. Most importantly, understand what happens to the server and its disk when you stop renting it.
Mentions
உங்கள் கணினியிலேயே படங்களை உருவாக்கும் Stable Diffusion WebUI. வார்த்தைகளை எழுதுங்கள், படம் கிடைக்கிறது.. முதலில் எந்தப் படத்தை உருவாக்குவீர்கள்? AUTOMATIC1111/stable-diffusion-webui Instagram-லும் பின்தொடருங்கள்: instagram.com
How to Fix Stable Diffusion WebUI Git Error Code 128 Stable Diffusion WebUI will not start because of git error code 128? Here is a written guide on what the sources say to check. This video covers: Stable diffusion error code 128 1. Read the stderr line in the traceback 2. Trust the folder if git reports dubious ownership 3. Look for a malformed repository URL 4. Override the Stable Diffusion repo in webui-user.bat 5. Save the file and relaunch the WebUI Sources: stable-diffusion-webui#8859 stable-diffusion-webui#7134 This guide is written from the sources listed below. Testreel did not test these steps, so check them against your own device or situation. Sources 1. Error code: 128 · AUTOMATIC1111/stable-diffusion-webui · Discussion #8859 stable-diffusion-webui#8859 2. Error code: 128. please help · AUTOMATIC1111/stable-diffusion-webui · Discussion #7134 stable-diffusion-webui#7134 The voice in this video is AI-generated. This guide is written from the sources listed below. Testreel did not test these steps, so check them against your own device or situation. #StableDiffusion #Git #Troubleshooting #Shorts
16. Stable Diffusion Web UI It is also known as AUTOMATIC1111, gives you an interface for generating images with Stable Diffusion. Instead of working with the model directly, you can use a web interface to create images from text prompts. AUTOMATIC1111/stable-diffusion-webui
Running Stable Diffusion on a Rented GPU Server A rented GPU that looked cheap on the hourly listing cost me more than expected: I left it running overnight after the first image finished. The model took minutes to load, but the idle machine kept billing for hours. This walkthrough covers choosing a GPU, setting up Stable Diffusion on Ubuntu, connecting securely, and avoiding that kind of surprise. Choose a server that fits the model For a first run, an NVIDIA GPU with 8 GB of VRAM is a reasonable target for Stable Diffusion 1.5. SDXL is more comfortable with 12 GB or more, though actual requirements depend on resolution, batch size, and optimizations. Check the GPU model and VRAM before renting; a listing’s “GPU memory” and its system RAM are different things. Disk space matters too. I’d start with at least 50 GB of persistent storage for the operating system, Python dependencies, model checkpoints, and generated images. More is useful if you plan to keep multiple models. Vast.ai is a good option I’ve used and tested for on-demand GPU rentals, with a range of hardware and prices. PowerVPS is another provider I’ve used and tested for VPS workloads; check its current offerings if you need a longer-lived server or supporting services, and confirm GPU availability before choosing a plan. In either case, compare the total cost, including storage and any charges that continue when the GPU is idle. The Server Rental Guide is a useful resource when comparing rental options and terms. Start with a clean Ubuntu server Choose an Ubuntu 22.04 image with NVIDIA drivers already installed if the provider offers one. That avoids spending your first session debugging driver setup. After connecting over SSH, confirm the GPU is visible: nvidia-smi You should see the GPU model, driver version, and memory. If the command is missing or reports no devices, check the provider’s GPU image and driver instructions before installing anything else. Driver installation varies by image and provider. Install the basic tools: sudo apt update sudo apt install -y git python3 python3-venv python3-pip For this example, use AUTOMATIC1111’s Stable Diffusion WebUI. Its first startup installs Python dependencies, so allow time for that, and keep the server’s disk persistent if you want to reuse the installation. git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git cd stable-diffusion-webui You’ll need a model checkpoint that you’re allowed to use. Download it through the model host’s normal process, then copy it to the server or download it from the server if the host provides a direct link. Some model hosts require accepting a license or signing in. Put the .safetensors file in the WebUI’s model directory: mkdir -p models/Stable-diffusion # Copy your checkpoint into models/Stable-diffusion/ For example, from your local computer, copy a file with scp: scp ./my-model.safetensors USER@HOST:stable-diffusion-webui/models/Stable-diffusion/ Replace USER and HOST with the SSH login details supplied by your provider. This command assumes the clone is in the remote user’s home directory. Launch it without exposing the UI publicly Start the WebUI so it listens on the server’s network interfaces: ./webui.sh --listen --port 7860 Keep this process running in your SSH session for the first test. The UI does not require you to open port 7860 to the internet. Instead, keep the provider firewall or security group closed to inbound traffic on that port and create a tunnel from your local machine: ssh -L 7860:127.0.0.1:7860 USER@HOST Then open http://127.0.0.1:7860 in your local browser. The tunnel forwards your local port to the WebUI on the server. If port 7860 is already in use locally, choose another local port, for example: ssh -L 7861:127.0.0.1:7860 USER@HOST In that case, open http://127.0.0.1:7861. Avoid exposing an unauthenticated image-generation UI directly to the public internet. Generate a first image and check utilization Select the checkpoint in the UI, enter a prompt, and start with a modest configuration: 512×512 resolution, one image, and around 20 steps. Once that works, try larger resolutions or other settings. Watch GPU usage in a second SSH session: nvidia-smi A GPU that appears underutilized may be waiting on model loading, disk access, or a setting that sends work to the CPU. Don’t assume a higher step count is always better; it increases generation time, and the visual difference depends on the prompt and sampler. Two rental habits that save trouble Keep models on persistent storage. Many rental platforms distinguish between stopping a machine and deleting it. A stopped instance may retain its disk; deleting it may remove the model files too. Check the provider’s rules before you end a session, and copy anything important off the server. Treat the hourly rate as only part of the cost. A GPU with more VRAM may finish a job faster, but the cheapest listing is not automatically the cheapest run. For a short task, compare estimated runtime as well as hourly price. Also check whether persistent disks are billed while the GPU is stopped. The details vary by provider and rental type. Shut down when you’re done Stop the WebUI with Ctrl+C in its SSH session. Then stop or release the rented instance using the provider’s controls. Don’t assume closing SSH stops the server. On some platforms, the machine keeps running—and billing—until you explicitly stop or terminate it. If you expect to return later, choose the option that preserves the disk and confirm its storage charges. If you no longer need the files, back up the outputs and remove the instance according to the provider’s instructions. Summary A rented GPU makes Stable Diffusion accessible without buying hardware, but the setup is only half the job: model storage, network access, and shutdown behavior all affect the experience and the bill. Start with a preconfigured Ubuntu GPU image, verify it with nvidia-smi, use a model you’re licensed to run, and access the WebUI through an SSH tunnel. Most importantly, understand what happens to the server and its disk when you stop renting it.
@neon_loom Interesting cyborg. github.com/AUTOMATIC1111/stable-diffusion-webui/d…
VRAM 2GBで画像生成してみる はじめに Claude先生に質問したところ、VRAMが2GBでもStable Diffusion 1.5なら何とか画像生成できるそうなのでトライしてみます。今さらStable Diffusionを使うのかと言われそうですが、今までは筆者のPCのVRAMが少なすぎるので完全に諦めていたのです。 なおStable Diffusion 1.5は、推奨するPythonのバージョンが「3.10.6」になるのですが、筆者の環境には下図のとおり「3.12.10」が導入済で、競合しないように古いPythonを後から追加導入する必要があります。そこでインストール手順は[こちらのサイト](zenn.dev "画像生成AI『stable diffusion』、pythonが複数verある場合のインストール方法!")を参考にさせて頂きます。 !導入済Python 検証環境 例によってPCの構成は以下の通りです。Ivy Bridgeおじさんの代表として頑張ります。 - グラフィックボード: NVIDIA GeForce GT 1030 GDDR5 2GB - メモリ: 16GB DDR3 - CPU: Core i7-3770 - OS: Windows 11 Pro 24H2 - NVIDIAドライバ: 582.66 ※ NPU非搭載 検証手順 筆者の環境では、試行錯誤しながら一部の手順を変更する必要があったため、参考情報として記録に残します。 Git導入 GitHubのアカウントを持っていない場合は用意します。 Gitをインストールします。インストーラの入手先はこちらです。インストールオプションはデフォルトのままにします。 !Gitインストール画面 Python導入 導入済のPythonのバージョンを確認します。 ※ 「3.10.6」が未導入であることを確認します。 C:\>python -V Python 3.12.10 C:\>py --list -V:3.12 * Python 3.12 (64-bit) C:\>py -0p -V:3.12 * C:\Users\xxxxx\AppData\Local\Programs\Python\Python312\python.exe C:\> Python 3.10.6をインストールします。インストーラの入手先はこちらです。インストールオプションはデフォルトのままにします。 !Pythonインストール画面 コマンドプロンプトで下図のとおり、Python 3.10が追加されたことを確認します。 C:\>python -V Python 3.12.10 C:\>py --list -V:3.12 * Python 3.12 (64-bit) -V:3.10 Python 3.10 (64-bit) C:\>py -0p -V:3.12 * C:\Users\xxxxx\AppData\Local\Programs\Python\Python312\python.exe -V:3.10 C:\Users\xxxxx\AppData\Local\Programs\Python\Python310\python.exe C:\> Stable Diffusion導入 下図のとおりコマンドプロンプトで、Stable Diffusion用のディレクトリを作成し、git cloneします。 ※ たまたまドライブの空き容量が多い「Kドライブ」を利用しています。 K:\>mkdir StableDiffusion K:\>cd StableDiffusion K:\StableDiffusion>git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git Cloning into 'stable-diffusion-webui'... 下図のとおりコマンドプロンプトで、Stable Diffusion用のPython仮想環境を作成します。 K:\StableDiffusion>cd stable-diffusion-webui K:\StableDiffusion\stable-diffusion-webui>py -3.10 -m venv venv :::note info 参考とした手順では、ここで「pip」や「setuptools」パッケージを最新化していますが、現在では逆に新しくなり過ぎて後工程で別のエラーが出てしまうようなので、最新化は実施しないことにします。参考までに筆者の環境で導入されていた「pip」等のバージョンは以下の通りです。 K:\StableDiffusion\stable-diffusion-webui>.\venv\Scripts\activate (venv) K:\StableDiffusion\stable-diffusion-webui>pip list Package Version ---------- ------- pip 22.2.1 setuptools 63.2.0 [notice] A new release of pip available: 22.2.1 -> 26.2.1 [notice] To update, run: python.exe -m pip install --upgrade pip ::: 必要に応じてバックアップを取得してから、以下のファイルを書き換えます。 K:\StableDiffusion\stable-diffusion-webui\webui-user.bat 書き換えた箇所は、以下の2点です。 - COMMANDLINE_ARGS: VRAMが2GBでもStable Diffusionを動作させるため - STABLE_DIFFUSION_REPO: 初回起動エラーを回避するため @echo off set PYTHON= set GIT= set VENV_DIR= set COMMANDLINE_ARGS=--lowvram --xformers set STABLE_DIFFUSION_REPO=https://github.com/w-e-w/stablediffusion.git call webui.bat webui-user.batをダブルクリックして、Stable Diffusionを起動します。なお初回はGitHubにサインインする必要があるようです。 まとめ 短いプロンプトで、1分半程度で出力された画像サンプルがこちらです。画質は微妙ですが、VRAM 2GBでも画像生成を試すことは可能と言えそうです。 プロンプト: sunset !sunsetで出力された画像 プロンプト: oil painting bird !Stable Diffusion出力画像 bird
ちな対応策はこれでした stable-diffusion-webui#17204
16.5 万星。Stable Diffusion WebUI:AI 画图的经典入口,浏览器里写词调参批量出图。 装在自己电脑上,画多少张都不花钱,社区插件多到挑不完。 AUTOMATIC1111/stable-diffusion-webui