Skip to content

Commit

Permalink
TorchScript torch==1.7.0 Path support (#5781)
Browse files Browse the repository at this point in the history
* fix path error in export.py

* Update export.py

updated!

* Update export.py

oops forget something
  • Loading branch information
miknyko authored Nov 25, 2021
1 parent c55e674 commit 4c7b2bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion export.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def export_torchscript(model, im, file, optimize, prefix=colorstr('TorchScript:'
ts = torch.jit.trace(model, im, strict=False)
d = {"shape": im.shape, "stride": int(max(model.stride)), "names": model.names}
extra_files = {'config.txt': json.dumps(d)} # torch._C.ExtraFilesMap()
(optimize_for_mobile(ts) if optimize else ts).save(f, _extra_files=extra_files)
(optimize_for_mobile(ts) if optimize else ts).save(str(f), _extra_files=extra_files)

LOGGER.info(f'{prefix} export success, saved as {f} ({file_size(f):.1f} MB)')
except Exception as e:
Expand Down

0 comments on commit 4c7b2bd

Please sign in to comment.