ModelScope生产环境 cuda 报错怎么处理? CUDA out of memory. Tried to allocate 840.00 MiB (GPU 0; 14.56 GiB total capacity; 2.99 GiB already allocated; 237.50 MiB free; 4.24 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.
您先试下torch.cuda.empty_cache()。可以参考自定义数据集
https://github.com/modelscope/swift/blob/main/docs/source/LLM/%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%8E%E6%8B%93%E5%B1%95.md 此回答整理自钉群“魔搭ModelScope开发者联盟群 ①”