Update exporter.py

test-ncnn
Laughing-q 4 weeks ago
parent c4770e60f1
commit cab9470cc8
  1. 10
      ultralytics/engine/exporter.py

@ -572,8 +572,8 @@ class Exporter:
unzip_dir = safe_download(f"https://github.com/pnnx/pnnx/releases/download/{release}/{asset}", delete=True)
if check_is_path_safe(Path.cwd(), unzip_dir): # avoid path traversal security vulnerability
shutil.move(src=unzip_dir / name, dst=pnnx) # move binary to ROOT
pnnx.chmod(0o777) # set read, write, and execute permissions for everyone
shutil.rmtree(unzip_dir) # delete unzip dir
# pnnx.chmod(0o777) # set read, write, and execute permissions for everyone
# shutil.rmtree(unzip_dir) # delete unzip dir
ncnn_args = [
f'ncnnparam={f / "model.ncnn.param"}',
@ -602,9 +602,9 @@ class Exporter:
subprocess.run(cmd, check=True)
# Remove debug files
pnnx_files = [x.split("=")[-1] for x in pnnx_args]
for f_debug in ("debug.bin", "debug.param", "debug2.bin", "debug2.param", *pnnx_files):
Path(f_debug).unlink(missing_ok=True)
# pnnx_files = [x.split("=")[-1] for x in pnnx_args]
# for f_debug in ("debug.bin", "debug.param", "debug2.bin", "debug2.param", *pnnx_files):
# Path(f_debug).unlink(missing_ok=True)
yaml_save(f / "metadata.yaml", self.metadata) # add metadata.yaml
return str(f), None

Loading…
Cancel
Save