Apply Ruff 0.9.0 (#18622)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
cc1e77138c
commit
3902e740cf
22 changed files with 69 additions and 65 deletions
|
|
@ -357,7 +357,7 @@ class Exporter:
|
|||
)
|
||||
self.pretty_name = Path(self.model.yaml.get("yaml_file", self.file)).stem.replace("yolo", "YOLO")
|
||||
data = model.args["data"] if hasattr(model, "args") and isinstance(model.args, dict) else ""
|
||||
description = f'Ultralytics {self.pretty_name} model {f"trained on {data}" if data else ""}'
|
||||
description = f"Ultralytics {self.pretty_name} model {f'trained on {data}' if data else ''}"
|
||||
self.metadata = {
|
||||
"description": description,
|
||||
"author": "Ultralytics",
|
||||
|
|
@ -377,7 +377,7 @@ class Exporter:
|
|||
|
||||
LOGGER.info(
|
||||
f"\n{colorstr('PyTorch:')} starting from '{file}' with input shape {tuple(im.shape)} BCHW and "
|
||||
f'output shape(s) {self.output_shape} ({file_size(file):.1f} MB)'
|
||||
f"output shape(s) {self.output_shape} ({file_size(file):.1f} MB)"
|
||||
)
|
||||
|
||||
# Exports
|
||||
|
|
@ -427,11 +427,11 @@ class Exporter:
|
|||
predict_data = f"data={data}" if model.task == "segment" and fmt == "pb" else ""
|
||||
q = "int8" if self.args.int8 else "half" if self.args.half else "" # quantization
|
||||
LOGGER.info(
|
||||
f'\nExport complete ({time.time() - t:.1f}s)'
|
||||
f"\nExport complete ({time.time() - t:.1f}s)"
|
||||
f"\nResults saved to {colorstr('bold', file.parent.resolve())}"
|
||||
f'\nPredict: yolo predict task={model.task} model={f} imgsz={imgsz} {q} {predict_data}'
|
||||
f'\nValidate: yolo val task={model.task} model={f} imgsz={imgsz} data={data} {q} {s}'
|
||||
f'\nVisualize: https://netron.app'
|
||||
f"\nPredict: yolo predict task={model.task} model={f} imgsz={imgsz} {q} {predict_data}"
|
||||
f"\nValidate: yolo val task={model.task} model={f} imgsz={imgsz} data={data} {q} {s}"
|
||||
f"\nVisualize: https://netron.app"
|
||||
)
|
||||
|
||||
self.run_callbacks("on_export_end")
|
||||
|
|
@ -680,16 +680,16 @@ class Exporter:
|
|||
shutil.rmtree(unzip_dir) # delete unzip dir
|
||||
|
||||
ncnn_args = [
|
||||
f'ncnnparam={f / "model.ncnn.param"}',
|
||||
f'ncnnbin={f / "model.ncnn.bin"}',
|
||||
f'ncnnpy={f / "model_ncnn.py"}',
|
||||
f"ncnnparam={f / 'model.ncnn.param'}",
|
||||
f"ncnnbin={f / 'model.ncnn.bin'}",
|
||||
f"ncnnpy={f / 'model_ncnn.py'}",
|
||||
]
|
||||
|
||||
pnnx_args = [
|
||||
f'pnnxparam={f / "model.pnnx.param"}',
|
||||
f'pnnxbin={f / "model.pnnx.bin"}',
|
||||
f'pnnxpy={f / "model_pnnx.py"}',
|
||||
f'pnnxonnx={f / "model.pnnx.onnx"}',
|
||||
f"pnnxparam={f / 'model.pnnx.param'}",
|
||||
f"pnnxbin={f / 'model.pnnx.bin'}",
|
||||
f"pnnxpy={f / 'model_pnnx.py'}",
|
||||
f"pnnxonnx={f / 'model.pnnx.onnx'}",
|
||||
]
|
||||
|
||||
cmd = [
|
||||
|
|
@ -1139,7 +1139,9 @@ class Exporter:
|
|||
def export_imx(self, prefix=colorstr("IMX:")):
|
||||
"""YOLO IMX export."""
|
||||
gptq = False
|
||||
assert LINUX, "export only supported on Linux. See https://developer.aitrios.sony-semicon.com/en/raspberrypi-ai-camera/documentation/imx500-converter"
|
||||
assert LINUX, (
|
||||
"export only supported on Linux. See https://developer.aitrios.sony-semicon.com/en/raspberrypi-ai-camera/documentation/imx500-converter"
|
||||
)
|
||||
if getattr(self.model, "end2end", False):
|
||||
raise ValueError("IMX export is not supported for end2end models.")
|
||||
if "C2f" not in self.model.__str__():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue