intel/openvino-rs

Failed to load `Paddle` model

CrazyboyQCD opened this issue · 4 comments

OS: windows 11
Openvino Version : 2023.0
Code snippet) :

fn main() {
    let model_dir = "models/ch_PP-OCRv4_rec_infer".to_owned();
    let model_path = model_dir.clone() + "/inference.pdmodel";
    let weights_path = model_dir + "/inference.pdiparams";

    let mut core = openvino::Core::new(None).unwrap();

    let model = core
        .read_network_from_file(&model_path, &weights_path)
        .unwrap();

    let input_name = model.get_input_name(0).unwrap();
    println!("{input_name}");

    let output_name = model.get_output_name(0).unwrap();
    println!("{output_name}");

    let compiled_model = core.load_network(&model, "CPU").unwrap();
}

Error: General

I can get input name and output name but I got GeneralError(-1) in loading.

abrown commented

I'm afraid that the error visibility in OpenVINO's C API is just not very good and that is what prevents these Rust bindings from seeing the true failure. I opened an issue about this on the openvino repository several years ago, openvino#3231, but I don't think anything was done. Perhaps things will be better when we switch to using OpenVINO's 2.0 API, which is in the works, but I'm not sure. If you really need to know what went wrong right now, your best bet is to fire up a debugger, break at C++ exceptions, and then inspect the original C++ exception, stack trace, etc. Hope that helps!

I'm afraid that the error visibility in OpenVINO's C API is just not very good and that is what prevents these Rust bindings from seeing the true failure. I opened an issue about this on the openvino repository several years ago, openvino#3231, but I don't think anything was done. Perhaps things will be better when we switch to using OpenVINO's 2.0 API, which is in the works, but I'm not sure. If you really need to know what went wrong right now, your best bet is to fire up a debugger, break at C++ exceptions, and then inspect the original C++ exception, stack trace, etc. Hope that helps!

@abrown Thanks for replying, I'll take a look of debugger.
BTW, I want to know the current status of switching to 2.0 API, as I did not see further progress in #53 .

abrown commented

Progress on switching to the 2.0 API is on-going but there is no PR published yet; @rahulchaphalkar is working on it.

Should we close this issue? I'm not sure how much more we will be able to do on openvino-rs here, though it might be helpful to future users if you explain what it took to figure out the underlying error.

Progress on switching to the 2.0 API is on-going but there is no PR published yet; @rahulchaphalkar is working on it.

Should we close this issue? I'm not sure how much more we will be able to do on openvino-rs here, though it might be helpful to future users if you explain what it took to figure out the underlying error.

Ok, I will reopen this issue once I figure it out.