Skip to content

Commit

Permalink
Do not optimize CoreML TorchScript model (ultralytics#3055)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed May 6, 2021
1 parent e59979a commit e3ce0f7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions models/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@
print(f'\n{prefix} starting export with torch {torch.__version__}...')
f = opt.weights.replace('.pt', '.torchscript.pt') # filename
ts = torch.jit.trace(model, img, strict=False)
ts = optimize_for_mobile(ts) # https://pytorch.org/tutorials/recipes/script_optimized.html
ts.save(f)
optimize_for_mobile(ts).save(f) # https://pytorch.org/tutorials/recipes/script_optimized.html
print(f'{prefix} export success, saved as {f} ({file_size(f):.1f} MB)')
except Exception as e:
print(f'{prefix} export failure: {e}')
Expand Down

0 comments on commit e3ce0f7

Please sign in to comment.