npu型号:300I-DUO * 8
镜像:mindie:1.0.0-300I-Duo-py311-openeuler24.03-lts
Transformers ==4.44.0
通过网站 https://www.hiascend.com/zh/developer/opensource?name=Transformers 得知transfomers框架已原生支持昇腾。但在服务器上使用transfomers推理deepseek-r1-32b模型时报错:
python代码:
import torch
import torch_npu
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("/DeepSeek/DeepSeek-R1-Distill-Qwen-32B",device_map='auto')
tokenizer = AutoTokenizer.from_pretrained("/DeepSeek/DeepSeek-R1-Distill-Qwen-32B")
prompt = "How many r's are in the word \"strawberry\""
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate( //执行该步骤时报错
inputs.input_ids,
max_length=50,
temperature=0.7,
do_sample=True
)
请问有办法解决上述报错吗?
npu型号:300I-DUO * 8
镜像:mindie:1.0.0-300I-Duo-py311-openeuler24.03-lts
Transformers ==4.44.0
通过网站 https://www.hiascend.com/zh/developer/opensource?name=Transformers 得知transfomers框架已原生支持昇腾。但在服务器上使用transfomers推理deepseek-r1-32b模型时报错:
RuntimeError: copy_d2d:build/CMakeFiles/torch_npu.dir/compiler_depend.ts:274 NPU function error: c10_npu::acl::AclrtSynchronizeStreamWithTimeout(copy_stream), error code is 507013 [ERROR] 2025-03-24-09:50:43 (PID:20696, Device:1, RankID:-1) ERR00100 PTA call acl api failed [Error]: System Direct Memory Access (DMA) hardware execution error. Rectify the fault based on the error information in the ascend log. EH9999: Inner Error! The error from device(1), serial number is 2. there is a sdma error, sdma channel is 0, the channel exist the following problems: The SMMU returns a Terminate error during page table translation.. the value of CQE status is 2. the description of CQE status: When the SQE translates a page table, the SMMU returns a Terminate error.it's config include: setting1=0xc000080880e0000, setting2=0xff009000ff004c, setting3=0, sq base addr=0x800d00801003d000[FUNC:ProcessSdmaErrorInfo][FILE:device_error_proc.cc][LINE:811] rtStreamSynchronizeWithTimeout execute failed, reason=[sdma copy error][FUNC:FuncErrorReason][FILE:error_message_manage.cc][LINE:53] EH9999: [PID: 20696] 2025-03-24-09:50:43.862.868 synchronize stream failed, runtime result = 507013[FUNC:ReportCallError][FILE:log_inner.cpp][LINE:161] TraceBack (most recent call last): DEVICE[1] PID[20696]: EXCEPTION STREAM: Exception info:TGID=57595, model id=65535, stream id=2, stream phase=SCHEDULE Message info[0]:RTS_HWTS: hwts sdma error, slot_id=23, stream_id=2 Other info[0]:time=2025-03-24-09:50:42.606.749, function=int_process_hwts_sdma_error, line=2070, error code=0x20bpython代码:
import torch
import torch_npu
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("/DeepSeek/DeepSeek-R1-Distill-Qwen-32B",device_map='auto')
tokenizer = AutoTokenizer.from_pretrained("/DeepSeek/DeepSeek-R1-Distill-Qwen-32B")
prompt = "How many r's are in the word \"strawberry\""
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate( //执行该步骤时报错
inputs.input_ids,
max_length=50,
temperature=0.7,
do_sample=True
)
请问有办法解决上述报错吗?