Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

torchscript model size increases when loading and saving it again #45465

Open
iseeyuan opened this issue Sep 28, 2020 · 3 comments
Open

torchscript model size increases when loading and saving it again #45465

iseeyuan opened this issue Sep 28, 2020 · 3 comments
Labels
oncall: jit Add this issue/PR to JIT oncall triage queue

Comments

@iseeyuan
Copy link
Contributor

iseeyuan commented Sep 28, 2020

馃悰 Bug

For the same jit model file, if I load and save it again, the size increases from 1.8 MB to 3.1 MB.

To Reproduce

Steps to reproduce the behavior:

  1. Please note that the model link provided below is an internal link
    cp /mnt/vol/gfsai-oregon/aml/mobile-vision/body_tracking/ts_f179073222_300_10_3_opt_09162020/detectandtrack.jit ~/models/.
  2. Python
m = torch.jit.load("/Users/myuan/models/detectandtrack.jit")
m.save("/Users/myuan/models/detectandtrack_save_again.jit")

Expected behavior

detectandtrack_save_again.jit is 3 MB in size, which is larger than the original detectandtrack.jit.

Environment

  • PyTorch Version (1.6):
  • OS (Mac, CentOS):
  • How you installed PyTorch (Install, internal build):
  • Build command you used (if compiling from source):
  • Python version: 3.7
  • CUDA/cuDNN version: N/A
  • GPU models and configuration: N/A
  • Any other relevant information:
    The data folder in detectandtrack_save_again.jit is larger (from 1.7 MB to 3.8 MB) with more items (from 243 to 296 files).

Additional context

The model was generated with this script which takes in a trained model, runs optimize_for_mobile and saves the mobile model: https://www.internalfb.com/intern/diffusion/FBS/browse/master/fbcode/mobile-vision/projects/detectron2go/tools/generate_tracker.py?commit=1b05890d965b84d9390bcd55dfbd625073537392&lines=83-104
The model generation can be reproduced with the test plan in: D23739593

cc @gmagogsfm

@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Sep 28, 2020
@github-actions github-actions bot added this to Need triage in JIT Triage Sep 28, 2020
@suo suo moved this from Need triage to In progress in JIT Triage Sep 29, 2020
@nikithamalgifb
Copy link
Contributor

@ iseeyuan: Hi, I am working on this issue. Can you please help me with reproducing the issue? I wanted to understand how I could get a hold of the above model?

@dzhulgakov
Copy link
Collaborator

@nikithamalgifb
Copy link
Contributor

Removing the JIT tag, since this is not a JIT issue

@nikithamalgifb nikithamalgifb removed the oncall: jit Add this issue/PR to JIT oncall triage queue label Feb 5, 2021
@nikithamalgifb nikithamalgifb removed their assignment Feb 5, 2021
@zhangguanheng66 zhangguanheng66 added the oncall: jit Add this issue/PR to JIT oncall triage queue label Feb 5, 2021
@Lilyjjo Lilyjjo removed this from In progress in JIT Triage Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
oncall: jit Add this issue/PR to JIT oncall triage queue
Projects
None yet
Development

No branches or pull requests

5 participants