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

**URL:** <https://discuss.huggingface.co/t/runtimeerror-cuda-error-the-launch-timed-out-and-was-terminated/56976>\
**Category:** Beginners\
**Created:** [October 1, 2023, 5:27am UTC](https://discuss.huggingface.co/t/runtimeerror-cuda-error-the-launch-timed-out-and-was-terminated/56976 "2023-10-01T05:27:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gggdddrrr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/gggdddrrr/32/19966_2.png) [@gggdddrrr](https://discuss.huggingface.co/u/gggdddrrr)\
**Post date:** [October 1, 2023, 5:27am UTC](https://discuss.huggingface.co/t/runtimeerror-cuda-error-the-launch-timed-out-and-was-terminated/56976/1 "2023-10-01T05:27:29Z")

</div>

Hello 🙂

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.

---

<div class="post-metadata">

**Author:** ![mtrabado](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@mtrabado](https://discuss.huggingface.co/u/mtrabado)\
**Post date:** [October 23, 2023, 7:33am UTC](https://discuss.huggingface.co/t/runtimeerror-cuda-error-the-launch-timed-out-and-was-terminated/56976/2 "2023-10-23T07:33:17Z")

</div>

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

Thanks in advance 🙂
