Skip to content

Commit

Permalink
Patch for the WinError183 on the OpenVino export mode (#1386)
Browse files Browse the repository at this point in the history
* Fix WinError183 (Windows Error)

* Add commentary of the change

---------

Co-authored-by: Youho99 <[email protected]>
  • Loading branch information
ggiret-thinkdeep and Youho99 authored Oct 17, 2023
1 parent e85de73 commit af9b0b6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/anomalib/deploy/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ def _add_metadata_to_ir(xml_file: str, metadata: dict[str, Any], input_size: tup

tmp_xml_path = Path(xml_file).parent / "tmp.xml"
serialize(model, str(tmp_xml_path))
# we delete the file if it already exists, to prevent WinError 183 error on Windows
Path(xml_file).unlink(missing_ok=True)
tmp_xml_path.rename(xml_file)
# since we create new openvino IR files, we don't need the bin file. So we delete it.
tmp_xml_path.with_suffix(".bin").unlink()
Expand Down

0 comments on commit af9b0b6

Please sign in to comment.