I tried exporting a model for PyTorch Lite to use it on mobile.
Before I just used
script = torch.jit.trace(model, dummy_input) script.save("model.pt")
which resulted in a 46 MB file.
script = torch.jit.trace(model, dummy_input) script_opt = optimize_for_mobile(script) script_opt._save_for_lite_interpreter("model.ptl")
I get a resulting size of 92 MB.
I discovered that
optimize_for_mobile is the problem.
How does it make the export so much bigger?
Does it just optimize for speed not for size?