Skip to content

Commit

Permalink
chore(tools): add decode_in_inference option to export_torchscript (#…
Browse files Browse the repository at this point in the history
…1442)

chore(tools): add decode_in_inference option to export_torchscript
  • Loading branch information
owruby authored Aug 1, 2022
1 parent a5bb5ab commit d78fe47
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/export_torchscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ def make_parser():
parser.add_argument("-expn", "--experiment-name", type=str, default=None)
parser.add_argument("-n", "--name", type=str, default=None, help="model name")
parser.add_argument("-c", "--ckpt", default=None, type=str, help="ckpt path")
parser.add_argument(
"--decode_in_inference",
action="store_true",
help="decode in inference or not"
)
parser.add_argument(
"opts",
help="Modify config options using the command-line",
Expand Down Expand Up @@ -61,7 +66,7 @@ def main():
if "model" in ckpt:
ckpt = ckpt["model"]
model.load_state_dict(ckpt)
model.head.decode_in_inference = False
model.head.decode_in_inference = args.decode_in_inference

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

0 comments on commit d78fe47

Please sign in to comment.