# How do you run Stable Diffusion XL on a cloud GPU?

> Run Stable Diffusion XL on a cloud RTX 4090 at $0.37/hr with diffusers: install, batch script, fp16 VAE fix. Crypto, no KYC.

- URL: https://rentgpucrypto.com/guides/stable-diffusion-xl-cloud-gpu/
- Last updated: 2026-12-03
- Publisher: RentGPUCrypto (https://rentgpucrypto.com)

**Quick answer — Which cloud GPU runs Stable Diffusion XL?**

SDXL needs about 12 GB of VRAM in half precision, so a single RTX 4090 handles it with room for batches. On **RentGPUCrypto** that card costs $0.37/hr, paid in Monero, Bitcoin or USDT without KYC. A short diffusers script turns it into a batch image generator you control over SSH.

**In brief**

- **One RTX 4090 is enough** for SDXL base and refiner at 1024 × 1024; bigger cards only speed up large batches.
- **No gating**: SDXL 1.0 is on Hugging Face under the Open RAIL++-M licence, no login needed.
- **Use the fp16-fix VAE** or images can come out black when the VAE runs in half precision.
- **Script or interface**: diffusers for batch jobs; ComfyUI for node workflows, opened through an SSH tunnel.
- **Pay per minute** from prepaid RTX 4090 hours that never expire.

## Which RentGPUCrypto card should you pick for SDXL?

*GPUs for Stable Diffusion XL on RentGPUCrypto: VRAM, memory bandwidth and price per hour, 3 December 2026*

| GPU | VRAM | Memory bandwidth | Price per hour | Good for |
| --- | --- | --- | --- | --- |
| RTX 4090 | 24 GB | 1,008 GB/s | $0.37 | SDXL, LoRA tests, single images |
| RTX 5090 | 32 GB | 1,792 GB/s | $0.52 | Larger batches, FLUX next to SDXL |
| L40S | 48 GB | 864 GB/s | $0.99 | SDXL plus video models, long jobs |

## Why rent a GPU for SDXL instead of using a web service?

**You get root on a whole card, your own models and no content queue.** Hosted generators limit resolution, batch size and which checkpoints or LoRAs you can load. On a rented RTX 4090 you install any SDXL fine-tune from Hugging Face or your own training run, and generate thousands of images from a prompt file overnight.

According to RentGPUCrypto's price check of 3 December 2026, a 24-hour block of RTX 4090 time costs $8.88. Billing is per minute from that block and stops when you press Stop, so a two-hour batch uses two hours.

## How do you set up diffusers on the instance?

**Launch with the PyTorch with CUDA · Ubuntu image, then install diffusers and its helpers in a virtual environment.** The image already has a CUDA build of PyTorch; `--system-site-packages` lets the environment reuse it instead of downloading another copy.

The first run downloads the SDXL base weights into the Hugging Face cache on the local NVMe disk. That disk survives a stop, so later sessions start in seconds.

*Install diffusers*

```bash
python3 -m venv --system-site-packages ~/sdxl && source ~/sdxl/bin/activate
pip install -U diffusers transformers accelerate safetensors
python -c "import torch; print(torch.__version__, torch.cuda.is_available())"
```

## What does a batch generation script look like?

**Load the pipeline once in float16, then loop over prompts and seeds.** The script below reads one prompt per line from `prompts.txt` and writes numbered PNG files. Swapping the VAE for `madebyollin/sdxl-vae-fp16-fix` avoids the black or noisy images that the original SDXL VAE can produce in half precision.

*sdxl_batch.py*

```python
import torch
from pathlib import Path
from diffusers import StableDiffusionXLPipeline, AutoencoderKL

vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
pipe = StableDiffusionXLPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    vae=vae,
    torch_dtype=torch.float16,
    variant="fp16",
    use_safetensors=True,
).to("cuda")

out = Path("out"); out.mkdir(exist_ok=True)
prompts = [p.strip() for p in open("prompts.txt") if p.strip()]
for i, prompt in enumerate(prompts):
    for seed in range(4):
        g = torch.Generator("cuda").manual_seed(seed)
        img = pipe(prompt, num_inference_steps=30, guidance_scale=7.0,
                   width=1024, height=1024, generator=g).images[0]
        img.save(out / f"{i:04d}_{seed}.png")
```

## How do you get the images back?

**Pull them with `rsync` over the same SSH port, before you delete the instance.** `rsync` resumes interrupted transfers and only copies new files, so you can run it during a long batch. The [data transfer guide](https://rentgpucrypto.com/guides/move-data-to-a-gpu-instance/ "How to move data to and from a GPU instance") covers `scp`, `rsync` and object storage.

Remember the rule of the disk: it stays while the instance is stopped and is wiped for good when you delete it.

*Copy the outputs to your computer*

```bash
rsync -avz --progress -e "ssh -p <port>" root@<host>:~/out/ ./sdxl-out/
```

## Would ComfyUI be easier?

**For interactive work with node graphs, yes; for unattended batches, the script is simpler.** ComfyUI loads the same SDXL checkpoint from `models/checkpoints` and runs in your browser through an SSH tunnel to port 8188. The [ComfyUI and FLUX guide](https://rentgpucrypto.com/guides/comfyui-flux-on-rtx-5090/ "How to run ComfyUI with FLUX on an RTX 5090") shows the install, which is the same on an RTX 4090 apart from the PyTorch wheel.

If you would rather receive a ready machine, RentGPUCrypto's [environment setup](https://rentgpucrypto.com/environment-setup/ "GPU environment setup done for you") installs ComfyUI with one model and tests it for $49.

## Can you train an SDXL LoRA on the same card?

**Yes, an SDXL LoRA trains on one RTX 4090 with gradient checkpointing and a small batch.** The diffusers repository ships a `train_dreambooth_lora_sdxl.py` example that does this. For a full fine-tune of the UNet, an L40S with 48 GB gives more headroom. Training data and checkpoints sit on the NVMe disk, so copy them off before deleting the instance.

A practical routine: train the LoRA in one session, stop the instance, test the result the next day in the batch script above with `pipe.load_lora_weights()`, and only then decide whether a longer run is worth the GPU-hours.

## Stable Diffusion XL on a cloud GPU: questions

### How much VRAM does SDXL need?

About 12 GB in half precision by RentGPUCrypto's rule, base model only. The RTX 4090's 24 GB leave room for the refiner or batches of several images.

### Why are my SDXL images black?

The original SDXL VAE can overflow in float16 and return NaN values, which save as black images. Load `madebyollin/sdxl-vae-fp16-fix` as the VAE, or run the VAE in float32.

### Do I need a Hugging Face token for SDXL?

No. `stabilityai/stable-diffusion-xl-base-1.0` is not gated. You need a token only for gated repositories, such as FLUX.1 [dev].

### Can I use the generated images commercially?

The SDXL 1.0 licence, CreativeML Open RAIL++-M, allows commercial use within its use restrictions. Check the licence of any fine-tune or LoRA you add, since some forbid commercial use.

### How do I pay for the GPU?

Buy a block of RTX 4090 hours in Monero, Bitcoin, USDT, USDC, ETH, SOL or LTC. No ID and no email are needed; the login is a 16-digit account number.

**Verdict**

- **An RTX 4090 at $0.37 per hour** is the sensible card for SDXL; pay more only for large batches or video.
- **Use diffusers with the fp16-fix VAE** for batches, ComfyUI for interactive graphs.
- **Copy outputs out with rsync** before deleting the instance, since deletion wipes the disk.

## Sources

1. [stable-diffusion-xl-base-1.0 model card](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0) — Stability AI / Hugging Face
2. [Diffusers: Stable Diffusion XL](https://huggingface.co/docs/diffusers/using-diffusers/sdxl) — Hugging Face
3. [SDXL VAE fp16 fix](https://huggingface.co/madebyollin/sdxl-vae-fp16-fix) — Hugging Face
4. [Diffusers DreamBooth LoRA SDXL training example](https://github.com/huggingface/diffusers/tree/main/examples/dreambooth) — Hugging Face
5. [NVIDIA GeForce RTX 4090](https://www.nvidia.com/en-us/geforce/graphics-cards/40-series/rtx-4090/) — NVIDIA

**Generate SDXL images on an RTX 4090** $3.70 for 10 GPU-hours, paid in crypto, no KYC. [Rent an RTX 4090](https://rentgpucrypto.com/app/checkout/?product=rtx-4090&plan=rtx-4090-10h&from=guides-stable-diffusion-xl-cloud-gpu&lang=en) · [See GPU prices](https://rentgpucrypto.com/pricing/?from=guides-stable-diffusion-xl-cloud-gpu "How much does it cost to rent a GPU per hour?")

---

RentGPUCrypto: RentGPUCrypto rents whole NVIDIA GPUs (RTX 4090, RTX 5090, L40S, A100 80GB, H100, H200) with root SSH for AI inference, Stable Diffusion and fine-tuning, paid in 7 cryptocurrencies including Monero, with no KYC and no email required.
