Slackbot
01/24/2023, 12:18 AMSean
01/24/2023, 2:12 AMcustom_objects
field in the save model.
bentoml.pytorch.save_model(
"demo_mnist", # model name in the local model store
trained_model, # model instance being saved
custom_objects={ # save additional user-defined python objects
"tokenizer": tokenizer_object,
}
)
And get the custom object with model.custom_objects[]
.
import bentoml
bento_model: bentoml.Model = bentoml.models.get("iris_clf:latest")
print(bento_model.custom_objects)
Read more here. https://docs.bentoml.org/en/latest/concepts/model.htmlАлександр Сергей
01/24/2023, 8:48 AMcustom_objects
field be used to put the binary fine into the model as is?
As far as I understand, I'd have to first read the file content into python as e.g. bytes object and then it will be saved as pickle, so the actual file in the model folder will be different as pickle adds its header I guess.Sean
01/26/2023, 7:11 PMincludes
field in the bentofile.yaml
. It will get packaged into the bento. You can load the file using Python.Александр Сергей
02/01/2023, 8:38 AMincludes
, thank you!