🤨 RuntimeError: CUDA error: the launch timed out and was terminated

Hello :slight_smile:

It’s been several weeks since I encountered an error with Stable Diffusion on my computer (HP Z2 Mini, 16 GB of RAM). Since I updated stable diffusion with Automatic 1111, I have a “CUDA” error which prevents me from making large images (whereas before, everything worked fine).

here is the detail of this error, I hope to find some help,

thank you so much

Geoffrey


Traceback (most recent call last):
File “C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\threading.py”, line 1016, in _bootstrap_inner
self.run()
File “C:\Users\G\stable-diffusion-webui\modules\memmon.py”, line 53, in run
free, total = self.cuda_mem_get_info()
File “C:\Users\G\stable-diffusion-webui\modules\memmon.py”, line 34, in cuda_mem_get_info
return torch.cuda.mem_get_info(index)
File “C:\Users\G\stable-diffusion-webui\venv\lib\site-packages\torch\cuda\memory.py”, line 618, in mem_get_info
*** Error completing request
*** Arguments: (‘task(m3u61mpj738zl2g)’, ‘photo of a 30 year old German, worker, lora:epiNoiseoffset_v2:1 lora:add_detail:0.8’, ‘disfigured, ugly, deformed, blur’, , 27, ‘DPM++ 2M SDE Karras’, 1, 1, 7, 800, 400, False, 0.7, 2, ‘Latent’, 0, 0, 0, ‘Use same checkpoint’, ‘Use same sampler’, ‘’, ‘’, , <gradio.routes.Request object at 0x0000029B56D9B550>, 0, False, ‘’, 0.8, False, -1, 0, 0, 0, True, False, False, ‘positive’, ‘comma’, 0, False, False, ‘’, 1, ‘’, , 0, ‘’, , 0, ‘’, , True, False, False, False, 0, False) {}
return torch.cuda.cudart().cudaMemGetInfo(device)
RuntimeError: CUDA error: the launch timed out and was terminated
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

Traceback (most recent call last):
  File "C:\Users\G\stable-diffusion-webui\modules\call_queue.py", line 57, in f
    res = list(func(*args, **kwargs))
  File "C:\Users\G\stable-diffusion-webui\modules\call_queue.py", line 36, in f
    res = func(*args, **kwargs)
  File "C:\Users\G\stable-diffusion-webui\modules\txt2img.py", line 55, in txt2img
    processed = processing.process_images(p)
  File "C:\Users\G\stable-diffusion-webui\modules\processing.py", line 732, in process_images
    res = process_images_inner(p)
  File "C:\Users\G\stable-diffusion-webui\modules\processing.py", line 875, in process_images_inner
    x_samples_ddim = decode_latent_batch(p.sd_model, samples_ddim, target_device=devices.cpu, check_for_nans=True)
  File "C:\Users\G\stable-diffusion-webui\modules\processing.py", line 598, in decode_latent_batch
    devices.test_for_nans(sample, "vae")
  File "C:\Users\G\stable-diffusion-webui\modules\devices.py", line 117, in test_for_nans
    if not torch.all(torch.isnan(x)).item():
RuntimeError: CUDA error: the launch timed out and was terminated
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.

Traceback (most recent call last):
File “C:\Users\G\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py”, line 488, in run_predict
output = await app.get_blocks().process_api(
File “C:\Users\G\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py”, line 1431, in process_api
result = await self.call_function(
File “C:\Users\G\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py”, line 1103, in call_function
prediction = await anyio.to_thread.run_sync(
File “C:\Users\G\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py”, line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File “C:\Users\G\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py”, line 877, in run_sync_in_worker_thread
return await future
File “C:\Users\G\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py”, line 807, in run
result = context.run(func, *args)
File “C:\Users\G\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py”, line 707, in wrapper
response = f(*args, **kwargs)
File “C:\Users\G\stable-diffusion-webui\modules\call_queue.py”, line 77, in f
devices.torch_gc()
File “C:\Users\G\stable-diffusion-webui\modules\devices.py”, line 51, in torch_gc
torch.cuda.empty_cache()
File “C:\Users\G\stable-diffusion-webui\venv\lib\site-packages\torch\cuda\memory.py”, line 133, in empty_cache
torch._C._cuda_emptyCache()
RuntimeError: CUDA error: the launch timed out and was terminated
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

Hi. I am facing a similar issue. Did you find any solution?

Thanks in advance :slight_smile: