Skip to content

Commit d78fe47

Browse files
authored
chore(tools): add decode_in_inference option to export_torchscript (Megvii-BaseDetection#1442)
chore(tools): add decode_in_inference option to export_torchscript
1 parent a5bb5ab commit d78fe47

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/export_torchscript.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ def make_parser():
2727
parser.add_argument("-expn", "--experiment-name", type=str, default=None)
2828
parser.add_argument("-n", "--name", type=str, default=None, help="model name")
2929
parser.add_argument("-c", "--ckpt", default=None, type=str, help="ckpt path")
30+
parser.add_argument(
31+
"--decode_in_inference",
32+
action="store_true",
33+
help="decode in inference or not"
34+
)
3035
parser.add_argument(
3136
"opts",
3237
help="Modify config options using the command-line",
@@ -61,7 +66,7 @@ def main():
6166
if "model" in ckpt:
6267
ckpt = ckpt["model"]
6368
model.load_state_dict(ckpt)
64-
model.head.decode_in_inference = False
69+
model.head.decode_in_inference = args.decode_in_inference
6570

6671
logger.info("loading checkpoint done.")
6772
dummy_input = torch.randn(args.batch_size, 3, exp.test_size[0], exp.test_size[1])

0 commit comments

Comments
 (0)