Repository: pytorch
Issue: RuntimeError: handle_0 INTERNAL ASSERT FAILED at "../c10/cuda/driver_api.cpp":15
Labels: module: cuda,triaged

### 🐛 Describe the bug

Traceback (most recent call last):
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/txt2img.py", line 55, in txt2img
        processed = processing.process_images(p)
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/processing.py", line 732, in process_images
        res = process_images_inner(p)
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/processing.py", line 867, in process_images_inner
        samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/processing.py", line 1156, in sample
        return self.sample_hr_pass(samples, decoded_samples, seeds, subseeds, subseed_strength, prompts)
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/processing.py", line 1216, in sample_hr_pass
        samples = images_tensor_to_samples(decoded_samples, approximation_indexes.get(opts.sd_vae_encode_method))
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/sd_samplers_common.py", line 110, in images_tensor_to_samples
        x_latent = model.get_first_stage_encoding(model.encode_first_stage(image))
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/sd_hijack_utils.py", line 17, in <lambda>
        setattr(resolved_obj, func_path[-1], lambda *args, **kwargs: self(*args, **kwargs))
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/sd_hijack_utils.py", line 28, in __call__
        return self.__orig_func(*args, **kwargs)
      File "/home/flyang/.local/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "/home/flyang/.local/lib/python3.10/site-packages/ldm/models/diffusion/ddpm.py", line 830, in encode_first_stage
        return self.first_stage_model.encode(x)
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/lowvram.py", line 67, in first_stage_model_encode_wrap
        return first_stage_model_encode(x)
      File "/home/flyang/.local/lib/python3.10/site-packages/ldm/models/autoencoder.py", line 83, in encode
        h = self.encoder(x)
      File "/home/flyang/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "/home/flyang/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
      File "/home/flyang/.local/lib/python3.10/site-packages/ldm/modules/diffusionmodules/model.py", line 526, in forward
        h = self.down[i_level].block[i_block](hs[-1], temb)
      File "/home/flyang/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "/home/flyang/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
      File "/home/flyang/.local/lib/python3.10/site-packages/ldm/modules/diffusionmodules/model.py", line 149, in forward
        return x+h
    RuntimeError: handle_0 INTERNAL ASSERT FAILED at "../c10/cuda/driver_api.cpp":15, please report a bug to PyTorch.

### Versions

Traceback (most recent call last):
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/txt2img.py", line 55, in txt2img
        processed = processing.process_images(p)
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/processing.py", line 732, in process_images
        res = process_images_inner(p)
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/processing.py", line 867, in process_images_inner
        samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/processing.py", line 1156, in sample
        return self.sample_hr_pass(samples, decoded_samples, seeds, subseeds, subseed_strength, prompts)
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/processing.py", line 1216, in sample_hr_pass
        samples = images_tensor_to_samples(decoded_samples, approximation_indexes.get(opts.sd_vae_encode_method))
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/sd_samplers_common.py", line 110, in images_tensor_to_samples
        x_latent = model.get_first_stage_encoding(model.encode_first_stage(image))
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/sd_hijack_utils.py", line 17, in <lambda>
        setattr(resolved_obj, func_path[-1], lambda *args, **kwargs: self(*args, **kwargs))
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/sd_hijack_utils.py", line 28, in __call__
        return self.__orig_func(*args, **kwargs)
      File "/home/flyang/.local/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "/home/flyang/.local/lib/python3.10/site-packages/ldm/models/diffusion/ddpm.py", line 830, in encode_first_stage
        return self.first_stage_model.encode(x)
      File "/mnt/p/home/flyang/stable-diffusion-webui/modules/lowvram.py", line 67, in first_stage_model_encode_wrap
        return first_stage_model_encode(x)
      File "/home/flyang/.local/lib/python3.10/site-packages/ldm/models/autoencoder.py", line 83, in encode
        h = self.encoder(x)
      File "/home/flyang/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "/home/flyang/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
      File "/home/flyang/.local/lib/python3.10/site-packages/ldm/modules/diffusionmodules/model.py", line 526, in forward
        h = self.down[i_level].block[i_block](hs[-1], temb)
      File "/home/flyang/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "/home/flyang/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
      File "/home/flyang/.local/lib/python3.10/site-packages/ldm/modules/diffusionmodules/model.py", line 149, in forward
        return x+h
    RuntimeError: handle_0 INTERNAL ASSERT FAILED at "../c10/cuda/driver_api.cpp":15, please report a bug to PyTorch.

cc @ptrblck