From 5a100f6b068282a169dc93e50379aac4360fb40e Mon Sep 17 00:00:00 2001 From: penn513 <35059704+penn513@users.noreply.github.com> Date: Tue, 23 Jul 2024 12:40:01 +0800 Subject: [PATCH] Fix accuracy error of NPUFusedAdam (#5777) Co-authored-by: gp513 Co-authored-by: Logan Adams <114770087+loadams@users.noreply.github.com> --- op_builder/npu/fused_adam.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/op_builder/npu/fused_adam.py b/op_builder/npu/fused_adam.py index fc1bc83c7cc7..d32103db7055 100644 --- a/op_builder/npu/fused_adam.py +++ b/op_builder/npu/fused_adam.py @@ -16,8 +16,8 @@ class NPUFusedAdam: @staticmethod def multi_tensor_adam(chunk_size, noop_flag_buffer, tensor_lists, lr, beta1, beta2, epsilon, step, adam_w_mode, bias_correction, weight_decay, *args): - bias_correction1 = beta1**step - bias_correction2 = beta2**step + bias_correction1 = beta1**(step - 1) + bias_correction2 = beta2**(step - 1) # iteration group['params'] for i in range(len(tensor_lists[0])):