华为计算微信公众号
昇腾AI开发者公众号
华为计算微博
华为计算今日头条
!atc --model=./malware5_model500.onnx --framework=5 --output=./Malware_Detection --soc_version=xxxx --input_shape="input:1,500" --host_env_os=linux --host_env_cpu=aarch64
def main(): model_path = 'Malware_Detection_linux_aarch64.om' # 初始化acl资源 acl_resource = AclLiteResource() acl_resource.init() model = AclLiteModel(model_path) # 初始化模型 input_data = torch.randint(1, 500) output = model.execute(input_data) print("out:",output)
init resource stage: Init resource success Init model resource start... [AclLiteModel] create model output dataset: --------------------------------------------------------------------------- Exception Traceback (most recent call last) /tmp/ipykernel_7858/451043146.py in <cell line: 1>() ----> 1 main() /tmp/ipykernel_7858/4101878335.py in main() 6 acl_resource.init() 7 ----> 8 model = AclLiteModel(model_path) 9 10 /usr/local/Ascend/thirdpart/aarch64/acllite/acllite_model.py in __init__(self, model_path, load_type) 42 self._model_desc = None # pointer when using 43 self._output_size = 0 ---> 44 self._init_resource() 45 self._is_destroyed = False 46 resource_list.register(self) /usr/local/Ascend/thirdpart/aarch64/acllite/acllite_model.py in _init_resource(self) 80 self._output_size = acl.mdl.get_num_outputs(self._model_desc) 81 # create output dataset ---> 82 self._gen_output_dataset(self._output_size) 83 # recode input data address,if need malloc memory,the memory will be 84 # reuseable /usr/local/Ascend/thirdpart/aarch64/acllite/acllite_model.py in _gen_output_dataset(self, ouput_num) 95 size = acl.mdl.get_output_size_by_index(self._model_desc, i) 96 buf, ret = acl.rt.malloc(size, const.ACL_MEM_MALLOC_NORMAL_ONLY) ---> 97 utils.check_ret("acl.rt.malloc", ret) 98 # crate oputput data buffer 99 dataset_buffer = acl.create_data_buffer(buf, size) /usr/local/Ascend/thirdpart/aarch64/acllite/acllite_utils.py in check_ret(message, ret_int) 15 """ 16 if ret_int != 0: ---> 17 raise Exception("{} failed ret_int={}" 18 .format(message, ret_int)) 19 Exception: acl.rt.malloc failed ret_int=100000
8.0.RC2
本帖最后由 匿名用户 于 2025/01/07 16:06:50 编辑
我要发帖子
模型转换代码
!atc --model=./malware5_model500.onnx --framework=5 --output=./Malware_Detection --soc_version=xxxx --input_shape="input:1,500" --host_env_os=linux --host_env_cpu=aarch64
推理代码
def main(): model_path = 'Malware_Detection_linux_aarch64.om' # 初始化acl资源 acl_resource = AclLiteResource() acl_resource.init() model = AclLiteModel(model_path) # 初始化模型 input_data = torch.randint(1, 500) output = model.execute(input_data) print("out:",output)报错信息
init resource stage: Init resource success Init model resource start... [AclLiteModel] create model output dataset: --------------------------------------------------------------------------- Exception Traceback (most recent call last) /tmp/ipykernel_7858/451043146.py in <cell line: 1>() ----> 1 main() /tmp/ipykernel_7858/4101878335.py in main() 6 acl_resource.init() 7 ----> 8 model = AclLiteModel(model_path) 9 10 /usr/local/Ascend/thirdpart/aarch64/acllite/acllite_model.py in __init__(self, model_path, load_type) 42 self._model_desc = None # pointer when using 43 self._output_size = 0 ---> 44 self._init_resource() 45 self._is_destroyed = False 46 resource_list.register(self) /usr/local/Ascend/thirdpart/aarch64/acllite/acllite_model.py in _init_resource(self) 80 self._output_size = acl.mdl.get_num_outputs(self._model_desc) 81 # create output dataset ---> 82 self._gen_output_dataset(self._output_size) 83 # recode input data address,if need malloc memory,the memory will be 84 # reuseable /usr/local/Ascend/thirdpart/aarch64/acllite/acllite_model.py in _gen_output_dataset(self, ouput_num) 95 size = acl.mdl.get_output_size_by_index(self._model_desc, i) 96 buf, ret = acl.rt.malloc(size, const.ACL_MEM_MALLOC_NORMAL_ONLY) ---> 97 utils.check_ret("acl.rt.malloc", ret) 98 # crate oputput data buffer 99 dataset_buffer = acl.create_data_buffer(buf, size) /usr/local/Ascend/thirdpart/aarch64/acllite/acllite_utils.py in check_ret(message, ret_int) 15 """ 16 if ret_int != 0: ---> 17 raise Exception("{} failed ret_int={}" 18 .format(message, ret_int)) 19 Exception: acl.rt.malloc failed ret_int=100000cann版本