VitisInspectoris an experimental new feature introduced in Vitis AI 2.5 to inspect a float model and show partition results for a given DPU target architecture, together with some indications on why the layers are not mapped to DPU. Without
target, we can only show some general, target-independent inspection results. Assign
targetto get more detailed inspect results for it.
Note: This feature in only available for default
pof2squantize strategy due to DPU limitations. This feature is experimental, please contact us if you encounter any bugs or problems.
The following codes show how to inspect a model.
model = tf.keras.models.load_model(‘float_model.h5’) from tensorflow_model_optimization.quantization.keras import vitis_inspect inspector = vitis_inspect.VitisInspector(target="DPUCADF8H_ISA0") inspector.inspect_model(model, plot=True, plot_file="model.svg", dump_results=True, dump_results_file="inspect_results.txt", verbose=0)
- string or None, the target DPU to deploy this model. It can be a name string (for example, DPUCAHX8L_ISA0), a JSON file path (for example, ./U50/arch.json) or a fingerprint. If set to None, no target will be applied and only some general, target-independent inspect results will be shown. The default value is None.
- tf.keras.Model instance, the float model to be inspected.
Float model should have concrete input shapes. Build the float model with
concrete input shapes or call inspect_model with the
- list(int) or list(list(int)), contains the input shape for each input layer. Use default shape info in the input layers if not set. Use list of shapes for multiple inputs, for example inspect_model(model, input_shape=[224, 224, 3]) or inspect_model(model, input_shape=[[224, 224, 3], [64, 1]]). All dimensions should have concrete values, and batch_size dimension should be omitted. The default value is None.
- bool, whether to plot the model inspect results by
graphvizand save image to disk. It is helpful when you need to visualize the model inspection results together with some modification hints. Note that only part of output file types can show the hints, such as
.svg.The default value is False.
- string, file path of model image file when plotting the model. The default value is model.svg.
- bool, whether to dump the inspect results and save text to disk. More detailed layer-by-layer results than screen logging will be dumped to the text file. The default value is False.
- string, file path of inspect results text file. The default value is inspect_results.txt.
- int, the logging verbosity level. More detailed logging results will be shown for higher verbose value. The default value is 0.