This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

代码编写器:TexasInstruments / edgeai-modelzoo 例程 问题

Part Number: CODECOMPOSER

Tool/software:

您好,我正在使用我们公司的示例代码进行自动化识别训练(QAT),我在代码中遇到一个问题:

我看到贵公司提供的量化工具:Github 中的 Readme 里面提到:

可选:我们提供了一个名为 torchvision.edgeailite.xnn.utils.load_weights() 的实用函数,它可以打印哪些参数已正确加载以及哪些参数未正确加载 - 如果需要,您可以使用此加载函数来确保您的参数已正确加载。

我想使用 torchvision.edgeailite.xnn.utils.load_weights()工具代码来进行量化训练后的模型检查,但是,我看到示例代码给出如下代码:

# load pretrained model
if pretrained_data is not None and not is_onnx_model:
    model_orig = get_model_orig(model)
    for (p_data,p_file) in zip(pretrained_data, pretrained_files):
        print("=> using pretrained weights from: {}".format(p_file))
        if hasattr(model_orig, 'load_weights'):
            model_orig.load_weights(pretrained=p_data, change_names_dict=change_names_dict)
        else:
            xnn.utils.load_weights(get_model_orig(model), pretrained=p_data, change_names_dict=change_names_dict)

通过以上代码,我无法直接执行else中的 xnn 实用程序load_weights() 函数。

请问我需要修改其他的代码或参数吗?或者删除 if,else ,直接执行xnn 实用程序load_weights() 函数?

期待您的回复!