输入文本过长导致报错,提示显存不足,清空history并torch.cuda.empty_cache()后显存仍被占用,此时再输入新的问题依然可能出现报错显存不足。
del并重新加载model后显存仍然显示被占用,但输入同样的问题可以正常使用,请问除了重新加载model外还有其他办法吗?
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 1.25 GiB (GPU 0; 23.65 GiB total capacity; 22.79 GiB already allocated; 81.31 MiB free; 22.82 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
Environment- OS:Ubuntu 18.04.6
- Python:3.9
- Transformers:4.26.1
- PyTorch:1.12
- CUDA Support : True