执行ops.matmul时,报错: Execute TaskFailCallback failed. task_fail_info or current_graph_ is nullptr
收藏回复举报
执行ops.matmul时,报错: Execute TaskFailCallback failed. task_fail_info or current_graph_ is nullptr
t('forum.solved') 已解决
新人帖
发表于2023-10-10 16:46:17
0 查看

mindspore 2.0环境,NPU为Ascend 910, 执行ops.matmul时,报错: Execute TaskFailCallback failed. task_fail_info or current_graph_ is nullptr,寻求帮助该问题怎么解决?

源代码:

for i1 in range(0, self.columns, blocksize):
    i2 = min(i1 + blocksize, self.columns)
    count = i2 - i1

    W1 = W[:, i1:i2].copy()
    Q1 = ops.zeros_like(W1)
    Err1 = ops.zeros_like(W1)
    Losses1 = ops.zeros_like(W1)
    Hinv1 = Hinv[i1:i2, i1:i2]

    for i in range(count):
        print(f"fasterquant compute for {name}-{i1}-{i} with blocksize {blocksize}, ", end="", flush=True)
        w = W1[:, i]
        d = Hinv1[i, i]
        if groupsize != -1:
            if (i1 + i) % groupsize == 0:
                self.quantizer.find_params(W[:, (i1 + i):(i1 + i + groupsize)], transpose_b=True)
            if ((i1 + i) // groupsize) - now_idx == -1:
                scale.append(self.quantizer.scale)
                now_idx += 1

        q, q_scale = self.quantizer.quantize(w, self.quantizer.scale[:, (i1 + i) % groupsize])
        q = q * q_scale
        Q1[:, i] = q
        Losses1[:, i] = (w - q)**2 / d**2
        err1 = (w - q) / d
        print(f"err1 shape {err1.shape}, Hinv1 shape {Hinv1.shape}, i index {i}")
        err1_0 = err1.reshape((-1, 1))
        Hinv1_0 = Hinv1[i, i:].reshape((1, -1))
        print(f"err1_0 NaN:{ops.any(ops.isnan(err1_0))}, INF:{ops.any(ops.isinf(err1_0))}, Real:{ops.any(ops.isreal(err1_0))}")
        print(f"Hinv1_0 NaN:{ops.any(ops.isnan(Hinv1_0))}, INF:{ops.any(ops.isinf(Hinv1_0))}, Real:{ops.any(ops.isreal(Hinv1_0))}")
        print(f"{6}, ", end="", flush=True)
        W1_add = ops.matmul(err1_0, Hinv1_0)
        print(f"{7}, ", end="", flush=True)
        print(f"W1 shape {W1.shape}, W1_add shape {W1_add.shape}, i index {i}")
        W1[:, i:] -= W1_add
        print(f"{8}, ", end="", flush=True)
        Err1[:, i] = err1
        print(f"{9}", flush=True)

    Q[:, i1:i2] = Q1
    Losses[:, i1:i2] = Losses1 / 2

    W[:, i2:] -= ops.matmul(Err1, Hinv[i1:i2, i2:])

在第21次循环时过程报错:[ERROR] DEVICE(30456,ffff94121a40,python):2023-10-10-16:02:11.756.869 [mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc:661] TaskFailCallback] Execute TaskFailCallback failed. task_fail_info or current_graph_ is nullptr

位置已经定位到“W1_add = ops.matmul(err1_0, Hinv1_0)”

fasterquant compute for _output_mapping-0-18 with blocksize 128, err1 shape (50688,), Hinv1 shape (128, 128), i index 18
6, 7, W1 shape (50688, 128), W1_add shape (50688, 110), i index 18
8, 9
fasterquant compute for _output_mapping-0-19 with blocksize 128, err1 shape (50688,), Hinv1 shape (128, 128), i index 19
6, 7, W1 shape (50688, 128), W1_add shape (50688, 109), i index 19
8, 9
fasterquant compute for _output_mapping-0-20 with blocksize 128, err1 shape (50688,), Hinv1 shape (128, 128), i index 20
6, [ERROR] DEVICE(30456,ffff94121a40,python):2023-10-10-16:02:11.756.869 [mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc:661] TaskFailCallback] Execute TaskFailCallback failed. task_fail_info or current_graph_ is nullptr
[ERROR] DEVICE(30456,ffff94121a40,python):2023-10-10-16:02:11.758.114 [mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc:661] TaskFailCallback] Execute TaskFailCallback failed. task_fail_info or current_graph_ is nullptr
7, W1 shape (50688, 128), W1_add shape (50688, 108), i index 20
8, 9
fasterquant compute for _output_mapping-0-21 with blocksize 128, err1 shape (50688,), Hinv1 shape (128, 128), i index 21
6, 7, W1 shape (50688, 128), W1_add shape (50688, 107), i index 21
8, 9
fasterquant compute for _output_mapping-0-22 with blocksize 128, err1 shape (50688,), Hinv1 shape (128, 128), i index 22
6, 7, W1 shape (50688, 128), W1_add shape (50688, 106), i index 22
8, 9
fasterquant compute for _output_mapping-0-23 with blocksize 128, err1 shape (50688,), Hinv1 shape (128, 128), i index 23
6, 7, W1 shape (50688, 128), W1_add shape (50688, 105), i index 23
8, 9

在调试过程中,添加判断矩阵乘法输入是否存在异常值

err1_0 = err1.reshape((-1, 1))
Hinv1_0 = Hinv1[i, i:].reshape((1, -1))
print(f"err1_0 NaN:{ops.any(ops.isnan(err1_0))}, INF:{ops.any(ops.isinf(err1_0))}, Real:{ops.any(ops.isreal(err1_0))}")
print(f"Hinv1_0 NaN:{ops.any(ops.isnan(Hinv1_0))}, INF:{ops.any(ops.isinf(Hinv1_0))}, Real:{ops.any(ops.isreal(Hinv1_0))}")
print(f"{6}, ", end="", flush=True)
W1_add = ops.matmul(err1_0, Hinv1_0)

得到报错信息:

[ERROR] DEVICE(33315,ffffba8c8a40,python):2023-10-10-16:27:01.367.495 [mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc:661] TaskFailCallback] Execute TaskFailCallback failed. task_fail_info or current_graph_ is nullptr
[ERROR] DEVICE(33315,ffffba8c8a40,python):2023-10-10-16:27:01.369.674 [mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc:661] TaskFailCallback] Execute TaskFailCallback failed. task_fail_info or current_graph_ is nullptr
[ERROR] DEVICE(33315,ffffba8c8a40,python):2023-10-10-16:27:01.369.842 [mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_stream_manager.cc:189] SyncStream] Call runtime rtStreamSynchronize error.
[ERROR] DEVICE(33315,ffffba8c8a40,python):2023-10-10-16:27:01.369.864 [mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc:1118] SyncStream] Sync default stream failed.
Traceback (most recent call last):
  File "quant_for_layer.py", line 267, in <module>
    save_int8Model(args, ckpt_path="/naohai/pangu_alpha-r2.0beta_rotary-V3/layers_ckpt/")
  File "quant_for_layer.py", line 219, in save_int8Model
    int8Model.from_float(model_predict, hidden_list, args)
  File "/naohai/GPTQ-for-Naohai-V0/quant/opt.py", line 1141, in from_float
    self.output.from_float(module.output, hiddd_list, args, layer_name + "_output", layer_id=layer_id + 4)
  File "/naohai/GPTQ-for-Naohai-V0/quant/opt.py", line 308, in from_float
    self.mapping.from_float(module.mapping, hiddd_list["FeedForward_mapping"]["input"], args, layer_name+"_mapping", layer_id+0)
  File "/naohai/GPTQ-for-Naohai-V0/quant/linear.py", line 440, in from_float
    W_Q, scale = GPTQ.GPTQ_for_linear(module, input_x, args, layer_name, layer_id)
  File "/naohai/GPTQ-for-Naohai-V0/quant/gptq_V1.py", line 235, in GPTQ_for_linear
    Q, scale, g_idx, error = gptq.fasterquant(percdamp=args.percdamp, groupsize=args.groupsize, actorder=args.act_order, name=layer_name)
  File "/naohai/GPTQ-for-Naohai-V0/quant/gptq_V1.py", line 165, in fasterquant
    print(f"err1_0 NaN:{ops.any(ops.isnan(err1_0))}, INF:{ops.any(ops.isinf(err1_0))}, Real:{ops.any(ops.isreal(err1_0))}")
  File "/root/.local/lib/python3.7/site-packages/mindspore/common/tensor.py", line 427, in __str__
    return str(self.asnumpy())
  File "/root/.local/lib/python3.7/site-packages/mindspore/common/tensor.py", line 694, in asnumpy
    return Tensor_.asnumpy(self)
RuntimeError: Sync stream error!

----------------------------------------------------
- Ascend Error Message:
----------------------------------------------------
EZ9999: Inner Error, Please contact support engineer!
EZ9999  Kernel task happen error, retCode=0x28, [aicpu timeout].[FUNC:PreCheckTaskErr][FILE:task.cc][LINE:1068]
        TraceBack (most recent call last):
        Aicpu kernel execute failed, device_id=0, stream_id=1, task_id=55611.[FUNC:PrintAicpuErrorInfo][FILE:task.cc][LINE:774]
        Aicpu kernel execute failed, device_id=0, stream_id=1, task_id=55875.[FUNC:PrintAicpuErrorInfo][FILE:task.cc][LINE:774]
        Aicpu kernel execute failed, device_id=0, stream_id=1, task_id=55611, fault op_name=[FUNC:GetError][FILE:stream.cc][LINE:1044]
        Aicpu kernel execute failed, device_id=0, stream_id=1, task_id=55875, fault op_name=[FUNC:GetError][FILE:stream.cc][LINE:1044]
        rtStreamSynchronize execute failed, reason=[aicpu timeout][FUNC:FuncErrorReason][FILE:error_message_manage.cc][LINE:49]

(Please search "Ascend Error Message" at https://www.mindspore.cn for error code description)

本帖最后由 匿名用户2023/10/10 16:50:52 编辑

我要发帖子