-
Notifications
You must be signed in to change notification settings - Fork 863
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
Wildcard search in model_archiver --extra-files #2142
Conversation
@gustavhartz Thanks for submitting the PR. Could you please include logs of a test with wildcard matching |
@agunapal I looked into creating a unit test for it to allow for testing using the torchserve_sanity script, but since "model_archiver.model_packaging.ModelExportUtils" is Mocked this isn't really possible.
cmd = test_utils.model_archiver_command_builder(
None,
"1.0",
os.path.join(test_utils.CODEBUILD_WD, "examples", "image_classifier", "resnet_18", "model.py"),
os.path.join(test_utils.MODEL_STORE, "resnet18-f37072fd.pth"),
"image_classifier",
os.path.join(test_utils.CODEBUILD_WD, "examples", "image_classifier", "*.json")
) would do the job as it is basically the same as many of the existing tests. What do you think? |
@gustavhartz Sorry, I just meant, can you please attach the TorchServe logs/ commands showing an example of this implementation working. It doesn't have to be a unit test. |
@agunapal Sure. Running
And then unzipping the .mar file reveals the wildcardfilname.txt file. PyTest output for running the model-archiver tests.
|
Codecov Report
@@ Coverage Diff @@
## master #2142 +/- ##
==========================================
+ Coverage 53.36% 53.37% +0.01%
==========================================
Files 71 71
Lines 3225 3226 +1
Branches 56 57 +1
==========================================
+ Hits 1721 1722 +1
Misses 1504 1504
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
…nts using glob (pytorch#2142) Co-authored-by: Ankith Gunapal <agunapal@meta.com> Co-authored-by: Mark Saroufim <marksaroufim@fb.com>
Description
Fixes #2111 (Feature request)
Implementation of wildcard filepaths for the model_archiver
Motivation
"Large Language Models like Bloom, for example, consist of hundreds of sharded model files. Integrating all the model files as extra-files parameters is a cumbersome process. Wildcard support would help to solve this quickly."
Implementation
The change uses the same logic as before for how the extra_files are passed to the model archiver, but now also allows for passing wildcard paths like. /project/models/**.bin using the glob python module.
This does not require any new dependencies, but an update to the documentation is needed to inform about the new feature.
Type of change
Please delete options that are not relevant.
Feature/Issue validation/testing
Running torchserve_sanity.py passes with no issues. The model_archiver PyTests already require the model_archiver to function properly. I did not add any new test to assert the wildcard functionality is operating as expected. Should I?
Checklist: