Hi, is Pytorch no longer natively supported in the...
# ask-for-help
k
Hi, is Pytorch no longer natively supported in the latest version of BentoML? I don't see any examples available https://docs.bentoml.com/en/latest/examples/overview.html
j
As pytorch is generally a very flexible framework, we have deprecated the support of
bentoml.pytorch
to give user more flexibility. To save your pytorch model with bentoml, we would point you to using the
bentoml.models.create
API https://docs.bentoml.com/en/latest/build-with-bentoml/model-loading-and-management.html which allow you to pack any arbitrary files into a "Model"
👀 1
🙏 1
k
Hi @Jian Shen Yap, I'm trying to dynamically add multiple models into the same BentoML service. Basically in
service.py
, I'm trying to load a list of BentoML models into a single variable. But when I do
bentoml build
and then
bentoml export
the .zip file doesn't contain the models. It only works when each BentoML model is a variable. I've replicated the unsuccessful code using the XGBoost example: https://github.com/TiewKH/BentoXGBoost/tree/main May i know if this is expected?
j
I think this is expected behaviour. packaging model into the bento works by scanning class variable of type
BentoModel
. @Frost Ming could you confirm?
gratitude thank you 1
This is the user's code
Copy code
class CancerTiewKHClassifier:
    # Retrieve the latest version of the model from the BentoML model store

    # This fails
    bento_model = [BentoModel(f"{model_name}:latest")]

    # This works
    # bento_model = BentoModel(f"{model_name}:latest")
✅ 1