Benchmark Model
-
benchmark_model
(self, model: Union[netspresso.launcher.schemas.model.ConversionTask, netspresso.launcher.schemas.model.Model, str], target_device: netspresso.launcher.schemas.model.TargetDevice = None, data_type: netspresso.launcher.schemas.DataType = 'FP16', wait_until_done: bool = True, target_device_name: netspresso.launcher.schemas.DeviceName = None, target_software_version: netspresso.launcher.schemas.SoftwareVersion = None, hardware_type: netspresso.launcher.schemas.HardwareType = None) → netspresso.launcher.schemas.model.BenchmarkTask Benchmark given model on the specified device.
- Parameters
model (ConversionTask | Model | str) – The conversion task object, Launcher Model Object or the uuid of the model.
target_device (TargetDevice) – target device. If it’s not set, target_device_name and target_software_version have to be set.
data_type (DataType) – data type of the model.
wait_until_done (bool) – if true, wait for the conversion result before returning the function. If false, request the conversion and return the function immediately.
target_device_name (DeviceName) – target device name. Necessary field if target_device is not given.
target_software_version (SoftwareVersion) – target_software_version. Necessary field if target_device_name is one of jetson devices.
hardware_type (HardwareType) – hardware_type. Acceleration options for the processor to the model inference.
- Raises
e – If an error occurs while benchmarking of the model.
- Returns
model benchmark task object.
- Return type
BenchmarkTask
Example
from netspresso.launcher import ModelBenchmarker, DeviceName
benchmarker = ModelBenchmarker(email="YOUR_EMAIL", password="YOUR_PASSWORD")
model: Model = benchmarker.upload_model("YOUR_MODEL_PATH")
benchmark_task = benchmarker.benchmark_model(
model=model,
target_device_name=DeviceName.JETSON_NANO,
target_software_version=SoftwareVersion.JETPACK_4_6,
wait_until_done=True
)