From 7b0629dac45d472e5d96953a4772fda4aacdd94b Mon Sep 17 00:00:00 2001 From: zhouwei <363232733@qq.com> Date: Mon, 6 May 2024 13:29:59 +0800 Subject: [PATCH] The training efficiency of the Ascend 910A has been significantly enhanced, leveraging the full computational power of the NPU (Neural Processing Unit) and the capabilities of torch_npu, a PyTorch library optimized for NPUs. This improvement has resulted in a remarkable tenfold increase in efficiency. Former-commit-id: 28ae947161d4670d4f865cbaad84397d47215a53 --- src/train.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/train.py b/src/train.py index 6a3212cb..e2609b66 100644 --- a/src/train.py +++ b/src/train.py @@ -1,3 +1,7 @@ +import os +import torch +import torch_npu +from torch_npu.contrib import transfer_to_npu from llmtuner.train.tuner import run_exp @@ -11,4 +15,6 @@ def _mp_fn(index): if __name__ == "__main__": + use_jit_compile = os.getenv('JIT_COMPILE', 'False').lower() in ['true', '1'] + torch.npu.set_compile_mode(jit_compile=use_jit_compile) main()