Skip to content

Commit 4c7b2bd

Browse files
authored
TorchScript torch==1.7.0 Path support (ultralytics#5781)
* fix path error in export.py * Update export.py updated! * Update export.py oops forget something
1 parent c55e674 commit 4c7b2bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

export.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def export_torchscript(model, im, file, optimize, prefix=colorstr('TorchScript:'
7171
ts = torch.jit.trace(model, im, strict=False)
7272
d = {"shape": im.shape, "stride": int(max(model.stride)), "names": model.names}
7373
extra_files = {'config.txt': json.dumps(d)} # torch._C.ExtraFilesMap()
74-
(optimize_for_mobile(ts) if optimize else ts).save(f, _extra_files=extra_files)
74+
(optimize_for_mobile(ts) if optimize else ts).save(str(f), _extra_files=extra_files)
7575

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

0 commit comments

Comments
 (0)