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.

How can I get the value of the "--extra-files" option in the handler?

See original GitHub issue

For example, the value of the “–serializedFile” option can be obtained with the following code

#Initialization functions in the handler class
def initialize(self, context):
        self.manifest = context.manifest
        serialized_file = self.manifest['model']['serializedFile']

How can I get the value of the “–extra-files” option?

Best regards.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
lxningcommented, Sep 6, 2022

@Shin-ichi-Takayama model-archiver manifest file format should be transparent to users. In other words, Torchseve can implement it in whatever format. Users don’t care as long as TorchServe provide API to allow users handler to be able to access the input items from model archiver command line.

existing model archiver only includes extra-files input from cmd-line, does not add sth like “extraFiles” in manifest model item. Wait for @chauhang to confirm the existing behavior is expected or not.

So there is no way for you to write code such as

extra_files : List = properties.get("extra_files")
for file in extra_files:
  if extra_file == "extra_file_name":
    do_x()
  ...

Let’s assume you are mar file creator. You know the input extra files. Then you can directly access the extra files in handler via model_dir/extra-fileXXX.

0reactions
Shin-ichi-Takayamacommented, Sep 8, 2022

@lxning Thank you very much. I understand now. My question has been answered and I will close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

serve/README.md at master · pytorch/serve - GitHub
We have copied the files from above example and made small changes to save the model's state dict and added default values. Training...
Read more >
Bootstrap your own Handler: How and why to create custom ...
What we need to add is the --extra-files option when creating your model archive. This is a comma-separated list of file paths that...
Read more >
ASP.NET Web Deployment using Visual Studio - Microsoft Learn
If you wanted to copy the ExtraFiles folder itself, the DestinationRelativePath value would be ExtraFiles%(RecursiveDir)%(Filename)%(Extension).
Read more >
Can parameters be used within extra files? - Stack Overflow
1 Answer 1 ... Read the contents of the file into a buffer. Be sure to allow the size of your buffer to...
Read more >
plugin - mkdocstrings
The value is the name of the handler module. Default is "python". handlers : Global configuration of handlers. You can set global configuration...
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