Skip to content

Commit

Permalink
bugfix: only load sample images when needed during model export
Browse files Browse the repository at this point in the history
Summary:
this makes getting started with model export easier as downloading the appropriate coco annotations and images is not required.

Pull Request resolved: #4079

Reviewed By: itomatik

Differential Revision: D39821989

Pulled By: itomatik

fbshipit-source-id: d2a8869067c7e05d60997dc09a4bf8be6eb5b525
  • Loading branch information
supershabam authored and facebook-github-bot committed Sep 29, 2022
1 parent b6657c4 commit 7c2c8fb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tools/deploy/export_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,14 @@ def get_sample_inputs(args):
DetectionCheckpointer(torch_model).resume_or_load(cfg.MODEL.WEIGHTS)
torch_model.eval()

# get sample data
sample_inputs = get_sample_inputs(args)

# convert and save model
if args.export_method == "caffe2_tracing":
sample_inputs = get_sample_inputs(args)
exported_model = export_caffe2_tracing(cfg, torch_model, sample_inputs)
elif args.export_method == "scripting":
exported_model = export_scripting(torch_model)
elif args.export_method == "tracing":
sample_inputs = get_sample_inputs(args)
exported_model = export_tracing(torch_model, sample_inputs)

# run evaluation with the converted model
Expand Down

0 comments on commit 7c2c8fb

Please sign in to comment.