Skip to content

Commit 7c2c8fb

Browse files
supershabamfacebook-github-bot
authored andcommitted
bugfix: only load sample images when needed during model export
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
1 parent b6657c4 commit 7c2c8fb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tools/deploy/export_model.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,14 @@ def get_sample_inputs(args):
214214
DetectionCheckpointer(torch_model).resume_or_load(cfg.MODEL.WEIGHTS)
215215
torch_model.eval()
216216

217-
# get sample data
218-
sample_inputs = get_sample_inputs(args)
219-
220217
# convert and save model
221218
if args.export_method == "caffe2_tracing":
219+
sample_inputs = get_sample_inputs(args)
222220
exported_model = export_caffe2_tracing(cfg, torch_model, sample_inputs)
223221
elif args.export_method == "scripting":
224222
exported_model = export_scripting(torch_model)
225223
elif args.export_method == "tracing":
224+
sample_inputs = get_sample_inputs(args)
226225
exported_model = export_tracing(torch_model, sample_inputs)
227226

228227
# run evaluation with the converted model

0 commit comments

Comments
 (0)