geekyutao / Inpaint-Anything

Inpaint anything using Segment Anything and inpainting models.
Apache License 2.0
6.4k stars 525 forks source link

torch.cuda.OutOfMemoryError: CUDA out of memory #143

Open cseconds opened 7 months ago

cseconds commented 7 months ago

hi, thank you for your great work.when I run "remove_anything_video.py", it comes to an error:

torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 1024.00 MiB. GPU 0 has a total capacity of 39.39 GiB of which 796.88 MiB is free. Process 2676485 has 31.25 GiB memory in use. Process 2908565 has 2.09 GiB memory in use. Including non-PyTorch memory, this process has 5.23 GiB memory in use. Of the allocated memory 4.67 GiB is allocated by PyTorch, and 71.64 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

here is my torch version: torch 2.2.1 torchaudio: 2.2.1 torchvision 0.17.1

and my instruction:

python remove_anything_video.py \ --input_video ./example/video/paragliding/original_video.mp4 \ --coords_type key_in \ --point_coords 652 162 \ --point_labels 1 \ --dilate_kernel_size 15 \ --output_dir ./results \ --sam_model_type "vit_h" \ --sam_ckpt ./pretrained_models/sam_vit_h_4b8939.pth \ --lama_config lama/configs/prediction/default.yaml \ --lama_ckpt ./pretrained_models/big-lama \ --tracker_ckpt vitb_384_mae_ce_32x4_ep300 \ --vi_ckpt ./pretrained_models/sttn.pth \ --mask_idx 2 \ --fps 25