continue-revolution / sd-webui-animatediff

AnimateDiff for AUTOMATIC1111 Stable Diffusion WebUI
Other
3.05k stars 253 forks source link

[Bug]: RuntimeError: CUDA error: device-side assert triggered #535

Closed GTurkistane-Plus closed 3 months ago

GTurkistane-Plus commented 3 months ago

Is there an existing issue for this?

Have you read FAQ on README?

What happened?

i am using the AUTOMATIC1111 Stable Diffusion webui, I installed the extension but and followed many tutorials, but when I hit generate, the cmd gives this error:

RuntimeError: CUDA error: device-side assert triggered


i was never able to get it to work, i have a 3090, and I am using Windows 10.

Screenshots:

image


image


image


image


image

Steps to reproduce the problem

enable it then run generation

What should have happened?

it should work?

Commit where the problem happens

webui: lastest version, it updates automatically extension: https://github.com/continue-revolution/sd-webui-animatediff.git

What browsers do you use to access the UI ?

FireFox

Command Line Arguments

set COMMANDLINE_ARGS=--medvram --api

Console logs

CMD:

*** Error completing request
*** Arguments: ('task(0ndjfsxrpiwsjx5)', <gradio.routes.Request object at 0x000001EC8EB83760>, '(highres,masterpiece,detailed)  1girl, bangs, bare_shoulders, black_hair, blue_sky, blush, bracelet, branch, breasts, brown_eyes, camellia, cherry_blossoms, cloud, collarbone, colored_inner_hair, day, dress, falling_petals, flower, hair_between_eyes, hair_flower, hair_ornament, hanami, hand_on_own_chest, holding_flower, japanese_clothes, jewelry, kimono, looking_at_viewer, multicolored_hair, off_shoulder, open_mouth, outdoors, petals, petals_on_liquid, pink_flower, pink_rose, plum_blossoms, red_flower, red_hair, red_rose, rose, rose_petals, short_hair, sky, smile, solo, spring_\\(season\\), tree, two-tone_hair', 'ugly, bad anatomy, bad proportions, messy color, monochrome, bad, signature, watermark, censored', [], 1, 1, 7, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', 'Use same scheduler', '', '', [], 0, 20, 'DPM++ 2M', 'Automatic', False, '', 0.8, -1, False, -1, 0, 0, 0, False, False, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, None, 'Refresh models', <scripts.animatediff_ui.AnimateDiffProcess object at 0x000001EC8EB80D90>, ControlNetUnit(is_ui=True, input_mode=<InputMode.SIMPLE: 'simple'>, batch_images='', output_dir='', loopback=False, enabled=False, module='none', model='None', weight=1.0, image=None, resize_mode=<ResizeMode.INNER_FIT: 'Crop and Resize'>, low_vram=False, processor_res=-1, threshold_a=-1.0, threshold_b=-1.0, guidance_start=0.0, guidance_end=1.0, pixel_perfect=False, control_mode=<ControlMode.BALANCED: 'Balanced'>, inpaint_crop_input_image=False, hr_option=<HiResFixOption.BOTH: 'Both'>, save_detected_map=True, advanced_weighting=None, effective_region_mask=None, pulid_mode=<PuLIDMode.FIDELITY: 'Fidelity'>, ipadapter_input=None, mask=None, batch_mask_dir=None, animatediff_batch=False, batch_modifiers=[], batch_image_files=[], batch_keyframe_idx=None), ControlNetUnit(is_ui=True, input_mode=<InputMode.SIMPLE: 'simple'>, batch_images='', output_dir='', loopback=False, enabled=False, module='none', model='None', weight=1.0, image=None, resize_mode=<ResizeMode.INNER_FIT: 'Crop and Resize'>, low_vram=False, processor_res=-1, threshold_a=-1.0, threshold_b=-1.0, guidance_start=0.0, guidance_end=1.0, pixel_perfect=False, control_mode=<ControlMode.BALANCED: 'Balanced'>, inpaint_crop_input_image=False, hr_option=<HiResFixOption.BOTH: 'Both'>, save_detected_map=True, advanced_weighting=None, effective_region_mask=None, pulid_mode=<PuLIDMode.FIDELITY: 'Fidelity'>, ipadapter_input=None, mask=None, batch_mask_dir=None, animatediff_batch=False, batch_modifiers=[], batch_image_files=[], batch_keyframe_idx=None), ControlNetUnit(is_ui=True, input_mode=<InputMode.SIMPLE: 'simple'>, batch_images='', output_dir='', loopback=False, enabled=False, module='none', model='None', weight=1.0, image=None, resize_mode=<ResizeMode.INNER_FIT: 'Crop and Resize'>, low_vram=False, processor_res=-1, threshold_a=-1.0, threshold_b=-1.0, guidance_start=0.0, guidance_end=1.0, pixel_perfect=False, control_mode=<ControlMode.BALANCED: 'Balanced'>, inpaint_crop_input_image=False, hr_option=<HiResFixOption.BOTH: 'Both'>, save_detected_map=True, advanced_weighting=None, effective_region_mask=None, pulid_mode=<PuLIDMode.FIDELITY: 'Fidelity'>, ipadapter_input=None, mask=None, batch_mask_dir=None, animatediff_batch=False, batch_modifiers=[], batch_image_files=[], batch_keyframe_idx=None), False, False, 'positive', 'comma', 0, False, False, 'start', '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, False, False, False, 0, False, None, None, False, None, None, False, None, None, False, 50) {}
    Traceback (most recent call last):
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\modules\txt2img.py", line 109, in txt2img
        processed = processing.process_images(p)
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\modules\processing.py", line 845, in process_images
        res = process_images_inner(p)
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 48, in processing_process_images_hijack
        return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\modules\processing.py", line 981, 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 "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\modules\processing.py", line 1328, in sample
        samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x))
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 218, in sample
        samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\modules\sd_samplers_common.py", line 272, in launch_sampling
        return func()
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 218, in <lambda>
        samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\sampling.py", line 594, in sample_dpmpp_2m
        denoised = model(x, sigmas[i] * s_in, **extra_args)
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
        return forward_call(*args, **kwargs)
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\modules\sd_samplers_cfg_denoiser.py", line 256, in forward
        x_out[a:b] = self.inner_model(x_in[a:b], sigma_in[a:b], cond=make_condition_dict(c_crossattn, image_cond_in[a:b]))
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
        return forward_call(*args, **kwargs)
      File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\extensions\sd-webui-animatediff\scripts\animatediff_infv2v.py", line 164, in mm_sd_forward
        x_in[_context], sigma_in[_context],
    RuntimeError: CUDA error: device-side assert triggered
    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 "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "F:\AI_STUFF\StableDiffusion\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 "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\modules\call_queue.py", line 95, in f
    mem_stats = {k: -(v//-(1024*1024)) for k, v in shared.mem_mon.stop().items()}
  File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\modules\memmon.py", line 92, in stop
    return self.read()
  File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\modules\memmon.py", line 77, in read
    free, total = self.cuda_mem_get_info()
  File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\modules\memmon.py", line 34, in cuda_mem_get_info
    return torch.cuda.mem_get_info(index)
  File "F:\AI_STUFF\StableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\cuda\memory.py", line 618, in mem_get_info
    return torch.cuda.cudart().cudaMemGetInfo(device)
RuntimeError: CUDA error: device-side assert triggered
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.

Additional information

just installed it normally and it did not work.

GTurkistane-Plus commented 3 months ago

it says: Compile with TORCH_USE_CUDA_DSA to enable device-side assertions. how do I do that?

zappityzap commented 3 months ago

Have you tried enabling the setting Pad prompt/negative prompt to be same length? Mentioned in this pinned issue: https://github.com/continue-revolution/sd-webui-animatediff/issues/83

Also a good idea to use the safetensors versions of the motion modules provided here: https://huggingface.co/conrevo/AnimateDiff-A1111/tree/main

GTurkistane-Plus commented 3 months ago

Have you tried enabling the setting Pad prompt/negative prompt to be same length? Mentioned in this pinned issue: #83

Also a good idea to use the safetensors versions of the motion modules provided here: https://huggingface.co/conrevo/AnimateDiff-A1111/tree/main

thank you this solved the issue

GTurkistane-Plus commented 3 months ago

Have you tried enabling the setting Pad prompt/negative prompt to be same length? Mentioned in this pinned issue: #83

Also a good idea to use the safetensors versions of the motion modules provided here: https://huggingface.co/conrevo/AnimateDiff-A1111/tree/main

thank you this solved the issue