SVD XT - Technique to reduce VRAM usage
HelloI am experimenting with SVD XT but I am getting stuck as I am getting the error below if I trying to go over 100 frames at 25fps at 1024x576. My renders are far more detailed if I encode at 2048x1080 (my preferred size), but the VRAM error appears above 25 frames. I am using comfyUI and used the startup commandpython main.py --disable-smart-memoryBut it made no difference.It seems that 24GB of VRAM is the most the mere mortals can afford from a Nvidia card. Are there techniques to sequentially calculate videos (preferably in comfyui) or some way to manage the VRAM?Many thanksRequested to load SVD_img2vid
Loading 1 new model
  0%|                                                                                                           | 0/20 [00:00<?, ?it/s]
ERROR:root:!!! Exception during processing !!!
ERROR:root:Traceback (most recent call last):
  File "/run/media/admin/SSD_1TB/ComfyUI/execution.py", line 155, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "/run/media/admin/SSD_1TB/ComfyUI/execution.py", line 85, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "/run/media/admin/SSD_1TB/ComfyUI/execution.py", line 78, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "/run/media/admin/SSD_1TB/ComfyUI/nodes.py", line 1389, in sample
    return common_ksampler(model, noise_seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise, disable_noise=disable_noise, start_step=start_at_step, last_step=end_at_step, force_full_denoise=force_full_denoise)
  File "/run/media/admin/SSD_1TB/ComfyUI/nodes.py", line 1325, in common_ksampler
    samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
  File "/run/media/admin/SSD_1TB/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/modules/impact/sample_error_enhancer.py", line 22, in informative_sample
    raise e
  File "/run/media/admin/SSD_1TB/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/modules/impact/sample_error_enhancer.py", line 9, in informative_sample
    return original_sample(*args, **kwargs)  # This code helps interpret error messages that occur within exceptions but does not have any impact on other operations.
  File "/run/media/admin/SSD_1TB/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/sampling.py", line 218, in motion_sample
    return orig_comfy_sample(model, noise, *args, **kwargs)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/sample.py", line 100, in sample
    samples = sampler.sample(noise, positive_copy, negative_copy, cfg=cfg, latent_image=latent_image, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, denoise_mask=noise_mask, sigmas=sigmas, callback=callback, disable_pbar=disable_pbar, seed=seed)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/samplers.py", line 716, in sample
    return sample(self.model, noise, positive, negative, cfg, self.device, sampler, sigmas, self.model_options, latent_image=latent_image, denoise_mask=denoise_mask, callback=callback, disable_pbar=disable_pbar, seed=seed)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/samplers.py", line 622, in sample
    samples = sampler.sample(model_wrap, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/samplers.py", line 561, in sample
    samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, **self.extra_options)
  File "/home/admin/anaconda3/envs/automatic/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/k_diffusion/sampling.py", line 154, in sample_euler_ancestral
    denoised = model(x, sigmas[i] * s_in, **extra_args)
  File "/home/admin/anaconda3/envs/automatic/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/samplers.py", line 285, in forward
    out = self.inner_model(x, sigma, cond=cond, uncond=uncond, cond_scale=cond_scale, model_options=model_options, seed=seed)
  File "/home/admin/anaconda3/envs/automatic/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/samplers.py", line 275, in forward
    return self.apply_model(*args, **kwargs)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/samplers.py", line 272, in apply_model
    out = sampling_function(self.inner_model, x, timestep, uncond, cond, cond_scale, model_options=model_options, seed=seed)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/samplers.py", line 252, in sampling_function
    cond_pred, uncond_pred = calc_cond_uncond_batch(model, cond, uncond_, x, timestep, model_options)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/samplers.py", line 226, in calc_cond_uncond_batch
    output = model.apply_model(input_x, timestep_, **c).chunk(batch_chunks)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/model_base.py", line 86, in apply_model
    model_output = self.diffusion_model(xc, t, context=context, control=control, transformer_options=transformer_options, **extra_conds).float()
  File "/home/admin/anaconda3/envs/automatic/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/ldm/modules/diffusionmodules/openaimodel.py", line 850, in forward
    h = forward_timestep_embed(module, h, emb, context, transformer_options, time_context=time_context, num_video_frames=num_video_frames, image_only_indicator=image_only_indicator)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/ldm/modules/diffusionmodules/openaimodel.py", line 42, in forward_timestep_embed
    x = layer(x, context, time_context, num_video_frames, image_only_indicator, transformer_options)
  File "/home/admin/anaconda3/envs/automatic/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/ldm/modules/attention.py", line 758, in forward
    x = block(
  File "/home/admin/anaconda3/envs/automatic/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/ldm/modules/attention.py", line 443, in forward
    return checkpoint(self._forward, (x, context, transformer_options), self.parameters(), self.checkpoint)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/ldm/modules/diffusionmodules/util.py", line 189, in checkpoint
    return func(*inputs)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/ldm/modules/attention.py", line 553, in _forward
    x = self.ff(self.norm3(x))
  File "/home/admin/anaconda3/envs/automatic/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/ldm/modules/attention.py", line 85, in forward
    return self.net(x)
  File "/home/admin/anaconda3/envs/automatic/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/admin/anaconda3/envs/automatic/lib/python3.10/site-packages/torch/nn/modules/container.py", line 217, in forward
    input = module(input)
  File "/home/admin/anaconda3/envs/automatic/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/ldm/modules/attention.py", line 64, in forward
    x, gate = self.proj(x).chunk(2, dim=-1)
  File "/home/admin/anaconda3/envs/automatic/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/run/media/admin/SSD_1TB/ComfyUI/comfy/ops.py", line 28, in forward
    return super().forward(*args, **kwargs)
  File "/home/admin/anaconda3/envs/automatic/lib/python3.10/site-packages/torch/nn/modules/linear.py", line 114, in forward
    return F.linear(input, self.weight, self.bias)
torch.cuda.OutOfMemoryError: Allocation on device 0 would exceed allowed memory. (out of memory)
Currently allocated     : 8.41 GiB
Requested               : 8.24 GiB
Device limit            : 23.69 GiB
Free (according to CUDA): 15.56 MiB
PyTorch limit (set by user-supplied memory fraction)
                        : 17179869184.00 GiBScreenshot from 2024-01-14 23-38-38954×918 71.9 KB