This message was deleted.
# events
s
This message was deleted.
s
Hi Sam, currently models must be loaded back to memory to use the
save_model
api. Does this not work for your use case?
s
Hi Sean, the problem here is we are having the inference script (script which would run the inference on the model) and the model_file separately and we would like to load the model when we start the server. If I can save the model directly then I could access the model in the serving script and then load it using the model_load_function from the inference script
The inference script we are having has four functions preprocess, model_load, predict and postprocess.
If we have to load the model and then save it I would have to extract the model_load function from the inference script and then save the model, which is a bit complex so looking if there is an alternative. Our current method : model = inference_script.model_load_function(.pth_file) bentoml.pytorch.save_model(model)
s
I see. Ideally
save_model
should be called when the
.pth
model file was created. So instead of saving to the
.pth
file, you would get a bentoml model object.
But I understand due to restrictions, this may not be possible.
s
Yeah exactly. We are getting the pretrained models in their respective library save formats
So there is a need to recreate the model object from the inference script users are providing
s
Loading model back into memory is usually fairly standard. Using PyTorch, it should be a few lines of Python code, if you do not wish to invoke the inference script.
s
Yeah, just looking if some simpler alternatives exist. Thanks @Sean.
👍 1