Hello, We get the following warning upon building ...
# ask-for-help
p
Hello, We get the following warning upon building / running a service with a reference to a model :
Copy code
2024-09-25T15:17:53+0200 [WARNING] [cli] `bentoml.models.get()` as the class attribute is not recommended because it requires the model to exist at import time. Use `_model_ref = BentoModel('my_model:pmknlqd3icvkz7uz')` instead.
However the documentation provides an example with
bentoml.models.get
(which seems more in-line with other
models
APIs) : https://docs.bentoml.com/en/latest/guides/model-store.html#retrieve-a-model Which is it? Is there a nuance that needs to be taken into account?
c
The nuance is user might be building a bento that references a model only exist remotely on BentoCloud but not locally. If your workflow primarily save model and build bento from the same environment, either way should work fine. BentoModel abstraction reference to the model lazily. @Frost Ming correct me if I’m wrong. The warning might be unnecessary. Could we show this warning when a model is not found locally during build?
f
It was originally made to promote the new lazy model class attributes. But since now it has not been officially announced nor is the doc updated, I agree we can remove the warning now.
p
Thanks for the info! 👌