Skip to content
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

Fix wild card in extra files #3304

Merged
merged 1 commit into from
Sep 11, 2024
Merged

Fix wild card in extra files #3304

merged 1 commit into from
Sep 11, 2024

Conversation

mreso
Copy link
Collaborator

@mreso mreso commented Sep 5, 2024

Description

This PR fixes the wild card feature in the model archiver

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Feature/Issue validation/testing

Please describe the Unit or Integration tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced.
Please also list any relevant details for your test configuration.

  • Test A
(serve) ubuntu@ip-172-31-55-226:~/serve$ mkdir extras
(serve) ubuntu@ip-172-31-55-226:~/serve$ touch extras/test1.txt
(serve) ubuntu@ip-172-31-55-226:~/serve$ touch extras/test2.txt
(serve) ubuntu@ip-172-31-55-226:~/serve$ torch-model-archiver --model-name mnist --version 1.0 --model-file examples/image_classifier/mnist/mnist.py --serialized-file examples/image_classifier/mnist/mnist_cnn.pt --handler  examples/image_classifier/mnist/mnist_handler.py --extra-files "extras/test?.txt" -f
WARNING - Overwriting /home/ubuntu/serve/mnist.mar ...
(serve) ubuntu@ip-172-31-55-226:~/serve$ torch-model-archiver --model-name mnist --version 1.0 --model-file examples/image_classifier/mnist/mnist.py --serialized-file examples/image_classifier/mnist/mnist_cnn.pt --handler  examples/image_classifier/mnist/mnist_handler.py --extra-files "extras/test[0-3].txt" -f
WARNING - Overwriting /home/ubuntu/serve/mnist.mar ...
(serve) ubuntu@ip-172-31-55-226:~/serve$ torch-model-archiver --model-name mnist --version 1.0 --model-file examples/image_classifier/mnist/mnist.py --serialized-file examples/image_classifier/mnist/mnist_cnn.pt --handler  examples/image_classifier/mnist/mnist_handler.py --extra-files "extras/test[3-5].txt" -f
WARNING - Overwriting /home/ubuntu/serve/mnist.mar ...
WARNING - Given wildcard pattern did not match any file: extras/test[3-5].txt
(serve) ubuntu@ip-172-31-55-226:~/serve$ torch-model-archiver --model-name mnist --version 1.0 --model-file examples/image_classifier/mnist/mnist.py --serialized-file examples/image_classifier/mnist/mnist_cnn.pt --handler  examples/image_classifier/mnist/mnist_handler.py --extra-files "extras/test[3-5].txt,extras/test[0-3].txt" -f
WARNING - Overwriting /home/ubuntu/serve/mnist.mar ...
WARNING - Given wildcard pattern did not match any file: extras/test[3-5].txt
(serve) ubuntu@ip-172-31-55-226:~/serve$ torch-model-archiver --model-name mnist --version 1.0 --model-file examples/image_classifier/mnist/mnist.py --serialized-file examples/image_classifier/mnist/mnist_cnn.pt --handler  examples/image_classifier/mnist/mnist_handler.py --extra-files "extras/test.txt,extras/test*.txt" -f
WARNING - Overwriting /home/ubuntu/serve/mnist.mar ...
Traceback (most recent call last):
  File "/home/ubuntu/miniconda3/envs/serve/bin/torch-model-archiver", line 33, in <module>
    sys.exit(load_entry_point('torch-model-archiver', 'console_scripts', 'torch-model-archiver')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/serve/model-archiver/model_archiver/model_packaging.py", line 72, in generate_model_archive
    package_model(config, manifest=manifest)
  File "/home/ubuntu/serve/model-archiver/model_archiver/model_packaging.py", line 45, in package_model
    model_path = ModelExportUtils.copy_artifacts(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/serve/model-archiver/model_archiver/model_packaging_utils.py", line 190, in copy_artifacts
    raise FileNotFoundError(
FileNotFoundError: File does not exist: extras/test.txt

Checklist:

  • Did you have fun?

Copy link
Collaborator

@agunapal agunapal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mreso mreso added this pull request to the merge queue Sep 11, 2024
Merged via the queue into master with commit d6ea6e7 Sep 11, 2024
12 checks passed
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.

2 participants