Skip to content

Improve Converting to Torchscript #6953

Closed

Description

@ericspod

Is your feature request related to a problem? Please describe.
Given a bundle with saved weights in the models directory and a network that's compatible with Torchscript, the command line to use ckpt_export gets rather long:

python -m monai.bundle ckpt_export --net_id network_def --bundle_root . --meta_file configs/metadata.json --config_file configs/inference.json --filepath models/model.ts  --ckpt_file models/model.pt --key_in_ckpt model

Would it be possible to simplify this by providing defaults for meta_file and others, or try to guess, if the loaded checkpoint is a dictionary, what key_in_ckpt would be?

Describe the solution you'd like
If the command line would be:

python -m monai.bundle ckpt_export --bundle_root . --config_file configs/inference.json --filepath models/model.ts

with everything omitted from the previous version replaced with defaults or guesses. If key_in_ckpt is needed that's fine but trying to guess and saying in the output what was guessed would often work. Similarly a defaults of configs/metadata.json for the meta file would usually work.

Describe alternatives you've considered
Keep using the old command line, it does work so this is about usability.

Additional context
The commands need more tutorial materials which is a work in progress.

Activity

  1. moved this to Bundle Todo in MONAI v1.3on Sep 6, 2023
  2. self-assigned this
    on Sep 8, 2023
  3. KumoLiu commented on Sep 8, 2023

    @KumoLiu
    Contributor

    I will take a look at this one.

  4. moved this from Bundle Todo to In Progress in MONAI v1.3on Sep 8, 2023
  5. added a commit that references this issue on Sep 8, 2023
    bd918eb
  6. moved this from In Progress to Done in MONAI v1.3on Sep 11, 2023
  7. added a commit that references this issue on Sep 11, 2023
    5fd23b8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BundlesAnything related to bundlesenhancementNew feature or request

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions