Skip to content

Enhanced code to extract and parse specific config files from TorchScript archive #378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 21, 2022

Conversation

MMelQin
Copy link
Collaborator

@MMelQin MMelQin commented Oct 21, 2022

Per bug report, the Config Parser needs to parse the full list of configs all at once.

  • As before, try to avoid extracting files to tmp dir, so if only one item is needed, directly read from the archive (into bytes). The helper function to extract content directly from a single file in the archive has been enhanced to try both supported file types, e.g. .json and .yaml.
  • When list of config (files) are need to be parsed
    • considered using mem mapped files to hole content retrieved from the archive, however, the underlying config parser function, load_config_file, does not support mmap type
    • have to use tempfile.TemporaryDirectory as destination for extracting only the files for the named configs, both .json and .ymal will be tried, first match wins
    • Tested with sample app which was updated to illustrate the use of setting config_names even though currently only inference is needed, beside metadata

Signed-off-by: M Q [email protected]

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@MMelQin MMelQin merged commit 1e73b2b into main Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] MONAI ConfigParser reads config files in a list
2 participants