pull/17463/head^2
Laughing-q 4 months ago
parent 37ebd142a2
commit cb834098e1
  1. 34
      ultralytics/engine/exporter.py

@ -1101,7 +1101,7 @@ class Exporter:
gptq_config=mct.gptq.get_pytorch_gptq_config(n_epochs=1000, use_hessian_based_weights=False), gptq_config=mct.gptq.get_pytorch_gptq_config(n_epochs=1000, use_hessian_based_weights=False),
core_config=config, core_config=config,
target_platform_capabilities=tpc, target_platform_capabilities=tpc,
) )[0]
if self.args.gptq if self.args.gptq
else mct.ptq.pytorch_post_training_quantization( # Perform post training quantization else mct.ptq.pytorch_post_training_quantization( # Perform post training quantization
in_module=self.model, in_module=self.model,
@ -1109,7 +1109,7 @@ class Exporter:
target_resource_utilization=resource_utilization, target_resource_utilization=resource_utilization,
core_config=config, core_config=config,
target_platform_capabilities=tpc, target_platform_capabilities=tpc,
) )[0]
) )
if self.args.nms: if self.args.nms:
@ -1171,21 +1171,21 @@ class Exporter:
onnx.save(model_onnx, f) onnx.save(model_onnx, f)
if not LINUX: # if not LINUX:
LOGGER.warning(f"{prefix} WARNING ⚠ MCT imx500-converter is only supported on Linux.") # LOGGER.warning(f"{prefix} WARNING ⚠ MCT imx500-converter is only supported on Linux.")
else: # else:
check_requirements("imx500-converter[pt]==3.14.1") # check_requirements("imx500-converter[pt]==3.14.1")
try: # try:
import subprocess # import subprocess
#
subprocess.run(["java", "--version"], check=True) # subprocess.run(["java", "--version"], check=True)
except FileNotFoundError: # except FileNotFoundError:
LOGGER.error( # LOGGER.error(
"Java 17 is required for the imx500 conversion. \n Please install Java with: \n sudo apt install openjdk-17-jdk openjdk-17-jre" # "Java 17 is required for the imx500 conversion. \n Please install Java with: \n sudo apt install openjdk-17-jdk openjdk-17-jre"
) # )
return None # return None
#
subprocess.run(["imxconv-pt", "-i", "yolov8n_mct_model.onnx", "-o", "yolov8n_imx500_model"], check=True) # subprocess.run(["imxconv-pt", "-i", "yolov8n_mct_model.onnx", "-o", "yolov8n_imx500_model"], check=True)
return f, None return f, None

Loading…
Cancel
Save