详情参考PyTorch官方文档。
内存使用到极限,有oom异常退出。
torch_npu.npu.set_per_process_memory_fraction(0.95)
export PYTORCH_NPU_ALLOC_CONF="garbage_collection_threshold:0.95"
export PYTORCH_NPU_ALLOC_CONF="max_split_size_mb:50"
export PYTORCH_NPU_ALLOC_CONF="expandable_segments:True"
若同时设置多个参数可以通过逗号分隔。
export PYTORCH_NPU_ALLOC_CONF="garbage_collection_threshold:0.95,max_split_size_mb:50,expandable_segments:True"