×

签到

分享到微信

打开微信,使用扫一扫进入页面后,点击右上角菜单,

点击“发送给朋友”或“分享到朋友圈”完成分享

mm模型加载时出现Error occurred during calling &#039cnInit&#039 in CNDrv interface. wangqingpeng2024-02-05 16:09:34 回复 1 查看 技术答疑 使用求助
mm模型加载时出现Error occurred during calling &#039cnInit&#039 in CNDrv interface.

报错信息:

2024-02-05 07:55:34.548966: [cnrtError] [22] [Card: NONE] Error occurred during calling 'cnInit' in CNDrv interface.

2024-02-05 07:55:34.548996: [cnrtError] [22] [Card: NONE] Return value is 100004, CN_ERROR_NO_DEVICE.

2024-02-05 07:55:34.549001: [cnrtError] [22] [Card: NONE] Failed to initialize CNDrv.

2024-02-05 07:55:34.549008: [cnrtError] [22] [Card: NONE] Call CALL_CNDRV(cnDeviceGetCount, &device_count)fail, returns: 100002.

Device count:  0

Invalid DEV_ID set!

exec_type: <class 'Asserti '>

exec_value: 

exec_traceback: <traceback at 0x7fe5f54e79b0>

Traceback (most recent call last):

  File "api.py", line 11, in <module>

    from reflective_main import mask

  File "/code/reflective_main.py", line 33, in <module>

    assert device_id < dev_count

Asserti

代码段:

device_id = 0
model_file="safetyHelmet_fp32.mm"
mm_model=mm.Model()
mm_model.deserialize_from_file(model_file)


with mm.System() as mm_sys:
    dev_count = mm_sys.device_count()
    print("Device count: ", dev_count)
    if device_id >= dev_count:
        print("Invalid DEV_ID set!")
        assert device_id < dev_count
    # 打开MLU设备
    dev = mm.Device()
    dev.id = device_id
    assert dev.active().ok()
    print("Wroking on MLU ", device_id)

    # crete engine, context and queue
    engine = mm_model.create_i_engine()
    assert engine is not None
    context = engine.create_i_context()
    assert context is not None
    queue = dev.create_queue()
    assert queue is not None

    context = context
    queue = queue


版权所有 © 2024 星空体育 备案/许可证号:京ICP备17003415号-1
关闭