[DOCS] improving the "conversion" section v2 (#20904)
adjustments to conversion and workflow
This commit is contained in:
parent
3a0abdfaa8
commit
5ee4090e10
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bbc2855ac007644a2562362bc7a8786c93b3d1d3e96ba733eec9a6c03f63a8c9
|
||||
size 160830
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a013860e4b2f942c5632bae8e3dfade266cfdcad2e34f6371ea8b1873e18f75b
|
||||
size 178797
|
||||
|
|
@ -20,36 +20,53 @@
|
|||
pytorch_2_0_torch_compile
|
||||
|
||||
|
||||
.. image:: ./_static/images/model_conversion_diagram.svg
|
||||
:alt: model conversion diagram
|
||||
|
||||
OpenVINO offers multiple workflows, depending on the use case and personal or project preferences.
|
||||
The diagram above is only a rough representation of the available options, but this section will
|
||||
give you a detailed view of how you can go from preparing your model, through optimizing it,
|
||||
to executing inference, and deploying your solution.
|
||||
This section will give you a detailed view of how you can go from preparing your model,
|
||||
through optimizing it, to executing inference, and deploying your solution.
|
||||
|
||||
Once you obtain a model in one of the :doc:`supported model formats <Supported_Model_Formats>`,
|
||||
you can decide how to proceed:
|
||||
|
||||
.. tab-set::
|
||||
|
||||
.. tab-item:: Workflow for convenience
|
||||
|
||||
This approach assumes you run your model directly.
|
||||
|
||||
.. image:: _static/images/ov_workflow_diagram_convenience.svg
|
||||
:align: center
|
||||
:alt: OpenVINO workflow diagram for convenience
|
||||
|
||||
.. tab-item:: Workflow for performance (recommended for production)
|
||||
|
||||
This approach assumes you convert your model to OpenVINO IR explicitly, which means the
|
||||
conversion stage is not part of the final application.
|
||||
|
||||
.. image:: _static/images/ov_workflow_diagram_performance.svg
|
||||
:align: center
|
||||
:alt: OpenVINO workflow diagram for performance
|
||||
|
||||
|
||||
|
||||
| :doc:`Model Preparation <openvino_docs_model_processing_introduction>`
|
||||
| Learn how to convert pre-trained models to OpenVINO IR, using different approaches for more convenience or higher performance.
|
||||
|
||||
| Learn how to convert pre-trained models to OpenVINO IR.
|
||||
|
||||
| :doc:`Model Optimization and Compression <openvino_docs_model_optimization_guide>`
|
||||
| Find out how to optimize a model to achieve better inference performance, utilizing multiple optimization methods for both in-training compression and post-training quantization.
|
||||
|
||||
| Find out how to optimize a model to achieve better inference performance, utilizing
|
||||
multiple optimization methods for both in-training compression and post-training quantization.
|
||||
|
||||
| :doc:`Running Inference <openvino_docs_OV_UG_OV_Runtime_User_Guide>`
|
||||
| See how to run inference with OpenVINO, which is the most basic form of deployment, and the quickest way of running a deep learning model.
|
||||
| See how to run inference with OpenVINO, which is the most basic form of deployment,
|
||||
and the quickest way of running a deep learning model.
|
||||
|
||||
| :doc:`Deployment Option 1. Using OpenVINO Runtime <openvino_deployment_guide>`
|
||||
| Deploy a model locally, reading the file directly from your application and utilizing resources available to the system.
|
||||
| Deployment on a local system uses the steps described in the section on running inference.
|
||||
|
||||
|
||||
| :doc:`Deployment Option 2. Using Model Server <ovms_what_is_openvino_model_server>`
|
||||
| Deploy a model remotely, connecting your application to an inference server and utilizing external resources, with no impact on the app's performance.
|
||||
| Deployment on OpenVINO Model Server is quick and does not require any additional steps described in the section on running inference.
|
||||
|
||||
|
||||
| :doc:`Deployment Option 3. Using torch.compile for PyTorch 2.0 <pytorch_2_0_torch_compile>`
|
||||
| Deploy a PyTorch model using OpenVINO in a PyTorch-native application.
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
:maxdepth: 1
|
||||
:hidden:
|
||||
|
||||
|
||||
Conversion Parameters <openvino_docs_OV_Converter_UG_Conversion_Options>
|
||||
Setting Input Shapes <openvino_docs_OV_Converter_UG_prepare_model_convert_model_Converting_Model>
|
||||
Convert from PyTorch <openvino_docs_OV_Converter_UG_prepare_model_convert_model_Convert_Model_From_PyTorch>
|
||||
|
|
@ -21,26 +20,29 @@
|
|||
Supported_Model_Formats
|
||||
|
||||
|
||||
To start working with OpenVINO, you need to obtain a model in one of the
|
||||
:doc:`supported model formats <Supported_Model_Formats>`. The easiest way
|
||||
to do so is to download a pre-trained network from an online database, such as
|
||||
`TensorFlow Hub <https://tfhub.dev/>`__,
|
||||
`Hugging Face <https://huggingface.co/>`__, or
|
||||
`Torchvision models <https://pytorch.org/hub/>`__.
|
||||
You can obtain a model in one of :doc:`supported formats <Supported_Model_Formats>`
|
||||
in many ways. The easiest one is to download it from an online database,
|
||||
such as `TensorFlow Hub <https://tfhub.dev/>`__, `Hugging Face <https://huggingface.co/>`__,
|
||||
and `Torchvision models <https://pytorch.org/hub/>`__. Now you have two options:
|
||||
|
||||
The OpenVINO workflow starts with converting the selected model to its
|
||||
proprietary format, :doc:`OpenVINO IR <openvino_ir>`
|
||||
(`openvino.Model <api/ie_python_api/_autosummary/openvino.runtime.Model.html>`__ -
|
||||
`ov.Model <api/ie_python_api/_autosummary/openvino.runtime.Model.html>`__).
|
||||
Although in most cases it can be done automatically, under the hood, explicit
|
||||
conversion may enable more optimization options and better performance.
|
||||
It is done in one of two ways:
|
||||
* Skip model conversion and run inference directly from the source format. Conversion
|
||||
will still be performed but it will happen automatically and "under the hood."
|
||||
This option, while convenient, offers lower performance and stability, as well as
|
||||
fewer optimization options.
|
||||
|
||||
* the Python API functions (``openvino.convert_model`` and ``openvino.save_model``)
|
||||
* the ``ovc`` command line tool.
|
||||
* Explicitly convert the model to :doc:`OpenVINO IR <openvino_ir>`.
|
||||
This approach offers the best possible results and is the recommended one,
|
||||
especially for for production-ready solutions. Explicit conversion can be done in two ways:
|
||||
|
||||
* the Python API functions (``openvino.convert_model`` and ``openvino.save_model``)
|
||||
* the ``ovc`` command line tool.
|
||||
|
||||
Once saved as :doc:`OpenVINO IR <openvino_ir>` (a set of ``.xml`` and ``.bin`` files),
|
||||
the model may be deployed with maximum performance. Because it is already optimized
|
||||
for OpenVINO inference, it can be read, compiled, and inferred with no additional delay.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
Model conversion API prior to OpenVINO 2023.1 is considered deprecated.
|
||||
Existing and new projects are recommended to transition to the new
|
||||
solutions, keeping in mind that they are not fully backwards compatible
|
||||
|
|
@ -48,13 +50,15 @@ It is done in one of two ways:
|
|||
For more details, see the :doc:`Model Conversion API Transition Guide <openvino_docs_OV_Converter_UG_prepare_model_convert_model_MO_OVC_transition>`.
|
||||
|
||||
|
||||
Convert a Model in Python: ``convert_model``
|
||||
Convert a Model with Python: ``convert_model``
|
||||
##############################################
|
||||
|
||||
The Model conversion API in Python uses the ``openvino.convert_model`` function,
|
||||
turning a given model to the ``openvino.Model`` object. The object may be used
|
||||
further, compiled and inferred, or saved to a drive as :doc:`OpenVINO IR <openvino_ir>`
|
||||
(``openvino.save_model`` produces a set of ``.xml`` and ``.bin`` files).
|
||||
turning a given model into the `openvino.Model <api/ie_python_api/_autosummary/openvino.runtime.Model.html>`__
|
||||
object and loading it to memory. Now it can be: saved to a drive with `openvino.save_model``
|
||||
or further :doc:`optimized with NNCF <openvino_docs_model_optimization_guide>`
|
||||
prior to saving.
|
||||
|
||||
|
||||
See how to use ``openvino.convert_model`` with models from some of the most popular
|
||||
public repositories:
|
||||
|
|
|
|||
Loading…
Reference in New Issue