import torch import torch_npu torch_npu.npu.set_compile_mode(jit_compile=False) ......
if is_distributed: mp.spawn(main_worker, nprocs=ngpus_per_node, args=(ngpus_per_node, args)) else: main_worker(args.gpu, ngpus_per_node, args) def main_worker(gpu, ngpus_per_node, args): # 加在进程拉起的主函数中 torch_npu.npu.set_compile_mode(jit_compile=False) ......