Skip to content

Commit

Permalink
fix: don't initialize cloud client until needed (#4989)
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <me@frostming.com>
  • Loading branch information
frostming authored Sep 23, 2024
1 parent 73e2f8c commit f64622a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/_bentoml_sdk/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from simple_di import inject

from bentoml._internal.bento.bento import BentoModelInfo
from bentoml._internal.cloud import BentoCloudClient
from bentoml._internal.cloud.client import RestApiClient
from bentoml._internal.cloud.schemas.modelschemas import LabelItemSchema
from bentoml._internal.cloud.schemas.modelschemas import ModelManifestSchema
Expand Down Expand Up @@ -120,7 +119,6 @@ def resolve(
self,
base_path: t.Union[PathType, FS, None] = None,
global_model_store: ModelStore = Provide[BentoMLContainer.model_store],
cloud_client: BentoCloudClient = Provide[BentoMLContainer.bentocloud_client],
) -> StoredModel:
stored = self.stored
if base_path is not None:
Expand All @@ -135,6 +133,7 @@ def resolve(
target_model_store=model_store,
)
return stored
cloud_client = BentoMLContainer.bentocloud_client.get()
model = cloud_client.model.pull(self.tag, model_store=model_store)
assert model is not None, "non-bentoml model"
return model
Expand Down

0 comments on commit f64622a

Please sign in to comment.