SeeSR icon indicating copy to clipboard operation
SeeSR copied to clipboard

Running out of GPU memory / VRAM

Open Courage-1984 opened this issue 1 year ago • 2 comments

I am using the following arguments:

python test_seesr.py --pretrained_model_path preset/models/stable-diffusion-2-base --prompt '' --seesr_model_path preset/models/seesr --ram_ft_path preset/models/DAPE.pth --image_path preset/datasets/test_datasets --output_dir preset/datasets/output --start_point lr --num_inference_steps 30 --guidance_scale 5.0 --process_size 384 --vae_decoder_tiled_size 384 --vae_encoder_tiled_size 384 --latent_tiled_size 48 --latent_tiled_overlap 4

but I get the following output after hours of processing:

input size: 2488x2864
[Tiled VAE]: input_size: torch.Size([2, 3, 2488, 2864]), tile_size: 384, padding: 32
[Tiled VAE]: split to 7x8 = 56 tiles. Optimal tile size 352x352, original tile size 384x384
[Tiled VAE]: Executing Encoder Task Queue: 100%|█████████████████████████████████| 5096/5096 [08:44<00:00,  9.72it/s]
[Tiled VAE]: Done in 525.361s, max VRAM alloc 7304.777 MB
  0%|                                                                                         | 0/30 [00:00<?, ?it/s][Tiled Latent]: the input size is 2488x2864, need to tiled
100%|█████████████████████████████████████████████████████████████████████████████| 30/30 [7:16:56<00:00, 873.88s/it]
[Tiled VAE]: the input size is tiny and unnecessary to tile.
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 1.70 GiB (GPU 0; 4.00 GiB total capacity; 9.37 GiB 
already allocated; 0 bytes free; 9.90 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try 
setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

I am running on GTX 1050 ti, and I know it's not ideal, but I am willing to wait... what can/should I change to avoid this?

I tried to run the following in my terminal before I run SeeSR but it didn't help:

set PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:256

Don't know if this helps or mean anything but SeeSR did work with the default arguments with the test dataset image provided by SeeSR.

Courage-1984 avatar Nov 05 '24 19:11 Courage-1984

你这都写了内存不足了,换一张显存大一点的显卡吧

SSSSamZhu avatar Dec 18 '24 01:12 SSSSamZhu

oh g, 1050ti ...

ZijiYu avatar Aug 11 '25 08:08 ZijiYu