question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Checkpoint Export Functionality Should Require Bundle Directory Path Only

See original GitHub issue

Is your feature request related to a problem? Please describe. Currently to export a bundle as a Torchscript file one has to specify the files to include individually, eg:

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

Describe the solution you’d like I think the optimal behaviour is to specify export of a whole bundle directory which will include all the config files in the configs directory and use models/model.pt as the model weight file implicitly. The network definition network_def is in config files in the tutorials example but perhaps it should be moved to the metadata.json file since there will really only be the one primary network definition per bundle. The actual command line to export would be :

python -m monai.bundle ckpt_export --bundle_path /path/to/bundle/dir --out_path foo.ts 

(I would also suggest changing filepath to out_path to be clearer about what it is.)

Describe alternatives you’ve considered The current command works just fine so this is a QoL improvement.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
ericspodcommented, Apr 22, 2022

Hi @Nic-Ma I’ll look at the PR now. I need to review Yiheng’s enhancements as well. I’m not sure I understand what the issue you’re describing is with the config files but we can discuss later today.

1reaction
ericspodcommented, Apr 21, 2022

By zip I mean the Torchscript zip file. My current workaround in the deploy context is this:

def get_bundle_config(bundle_path):
    """
    Get the configuration parser from the specified Torchscript bundle file path.
    """
    name, _ = os.path.splitext(os.path.basename(bundle_path))
    parser = ConfigParser()
    
    with tempfile.TemporaryDirectory() as td:
        archive = zipfile.ZipFile(bundle_path, "r")
        archive.extract(name + "/extra/metadata.json", td)
        archive.extract(name + "/extra/config", td)

        os.rename(f"{td}/{name}/extra/config", f"{td}/{name}/extra/config.json")

        parser.read_meta(f=f"{td}/{name}/extra/metadata.json")
        parser.read_config(f=f"{td}/{name}/extra/config.json")

        parser.parse()

    return parser

I would like to be able to read meta or config data from the zip via a data stream I can open using the zipfile API, all this would then go into an API function we’d provide. I’d also like to be able to select different json files since the Torchscript zip file could contain multiples like inference.json and training.json just like the bundle directory rather than putting multiple things together into config. I had to add the extension here as well to get things to parse. We could also support parsing from a zip file that contains the bundle (ie. is not a Torchscript object) as well by specifying paths in a similar way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the "Custom Intelligence Feeds" feature?
Custom Intelligence Feeds feature provides an ability to add custom cyber intelligence feeds into the Threat Prevention engine.
Read more >
How to migrate a competitor's database to Check Point with ...
In Target Folder, select the migration output path. ... (Optional) If you want optimize migration process, you have to check “Do not import...
Read more >
Usage Syntax - Check Point Support Center
Exporting Check Point configuration from Security Management Server into readable format using "Show Package Tool", Technical Level ...
Read more >
Administration Guide - HARMONY ENDPOINT - Check Point
You can export operational and threat analysis reports to review and ... Note - This feature is available only to customers in the...
Read more >
Configuring Advanced Threat Prevention Settings
You can perform these actions on a Check Point Management Server: ... Select the required file with the SNORT rules and click Open....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found