Fix review comments
This commit is contained in:
@@ -35,7 +35,6 @@ Let's consider the example, there is an original `ONNX` model which takes one `f
|
||||
@endsphinxdirective
|
||||
|
||||
- Preprocessing & Saving to IR code
|
||||
|
||||
@sphinxdirective
|
||||
|
||||
.. tab:: C++
|
||||
|
||||
@@ -200,10 +200,10 @@ void save_example() {
|
||||
void load_aftersave_example() {
|
||||
//! [ov:preprocess:save_load]
|
||||
ov::Core core;
|
||||
core.set_property({{CONFIG_KEY(CACHE_DIR), "/path/to/cache/dir"}});
|
||||
core.set_property(ov::cache_dir("/path/to/cache/dir"));
|
||||
|
||||
// In case that no preprocessing is needed anymore, we can load model on target device directly
|
||||
// With cached model available, it will also save some time on reading original model
|
||||
ov::CompiledModel compiled_model = core.compile_model("/path/to/some_model_saved.xml", "CPU");
|
||||
//! [ov:preprocess:save_load]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ ppp.output("result_image").postprocess()\
|
||||
# ! [ov:preprocess:save_headers]
|
||||
from openvino.preprocess import PrePostProcessor, ColorFormat, ResizeAlgorithm
|
||||
from openvino.runtime import Core, Layout, Type, set_batch
|
||||
from openvino.offline_transformations import serialize
|
||||
from openvino.runtime.passes import Manager
|
||||
# ! [ov:preprocess:save_headers]
|
||||
|
||||
# ! [ov:preprocess:save]
|
||||
@@ -210,8 +210,11 @@ model = ppp.build()
|
||||
set_batch(model, 2)
|
||||
|
||||
# ======== Step 3: Save the model ================
|
||||
serialize(model, '/path/to/some_model_saved.xml', '/path/to/some_model_saved.bin')
|
||||
|
||||
pass_manager = Manager()
|
||||
pass_manager.register_pass(pass_name="Serialize",
|
||||
xml_path='/path/to/some_model_saved.xml',
|
||||
bin_path='/path/to/some_model_saved.bin')
|
||||
pass_manager.run_passes(model)
|
||||
# ! [ov:preprocess:save]
|
||||
|
||||
# ! [ov:preprocess:save_load]
|
||||
|
||||
Reference in New Issue
Block a user