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

Multiple serialized models in one .mar file? #633

Closed
alexdmiller opened this issue Aug 20, 2020 · 2 comments
Closed

Multiple serialized models in one .mar file? #633

alexdmiller opened this issue Aug 20, 2020 · 2 comments
Assignees
Labels
triaged_wait Waiting for the Reporter's resp

Comments

@alexdmiller
Copy link

Is your feature request related to a problem? Please describe.

We have multiple serialized models that we would like to use for a single TorchServe endpoint.

Describe the solution

Right now, I'm not aware of a way to achieve this with TorchServe. When creating the .mar archive, only a single serialized model can be passed in.

Describe alternatives solution

If we could store multiple models in the .mar archive, then we could write a custom handler to load those models in and chain them together.

@harshbafna harshbafna self-assigned this Aug 20, 2020
@harshbafna
Copy link
Contributor

@alexdmiller: Currently TorchModelArchiver allows supplying only one serialized file with --serialized-file parameter while creating the mar. However, you can supply any number and any type of file with --extra-files flag. All the files supplied in the mar file are available in model_dir location which can be accessed through the context object supplied to the handler's entry point.

Sample code snippet:

properties = context.system_properties
model_dir = properties.get("model_dir")

@harshbafna harshbafna added the triaged_wait Waiting for the Reporter's resp label Aug 20, 2020
@alexdmiller
Copy link
Author

I see, that makes sense. That solves my problem, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged_wait Waiting for the Reporter's resp
Projects
None yet
Development

No branches or pull requests

2 participants