CUDA out of memory.

#55 · open · 2 comments

View on GitHub ↗

godoge

CUDA out of memory. Tried to allocate 20.92 GiB. GPU 0 has a total capacity of 8.00 GiB of which 2.22 GiB is free. Of the allocated memory 4.13 GiB is allocated by PyTorch, and 556.63 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://docs.pytorch.org/docs/stable/notes/cuda.html#optimizing-memory-usage-with-pytorch-cuda-alloc-conf)

Comments

Petriorlz

model = AutoModelForCausalLM.from_pretrained( model_id, trust_remote_code=True, dtype="auto", attn_implementation="sdpa", # or "flash_attention_2" with the flash-attn package installed ).to(dtype=dtype).to(device).eval() use sdpa or flash_attention_2

Petriorlz

Based on our testing, a 30-minute audio file consumes approximately 5 GB of cuda memory