Skip to content

Commit

Permalink
Fixed version pinning
Browse files Browse the repository at this point in the history
  • Loading branch information
Nepherhotep committed Nov 13, 2024
1 parent 7fb2aea commit 28d7524
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions orient_express/model_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def _vertex_init(self):
self._vertex_initialized = True

def get_latest_vertex_model(self, model_name):
"""If there are a few models with the same name, load the most recent one.
It's highly recommended to keep only 1 model with the same name to avoid the confusion
"""
self._vertex_init()

# Search for models with the specified display name
Expand Down Expand Up @@ -188,14 +191,14 @@ def local_predict_proba(self, input_df):
def load_model_from_registry(self):
self._vertex_init()

vertex_model = self.get_latest_vertex_model(self.model_name)

if self.model_version:
# reload the model using a specific model version
vertex_model = aiplatform.Model(
model_name=self.model_name, version=self.model_version
model_name=vertex_model.resource_name, version=str(self.model_version)
)

else:
vertex_model = self.get_latest_vertex_model(self.model_name)

if not vertex_model:
raise Exception(f"Model '{self.model_name}' not found in the registry.")

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "orient_express"
version = "0.3.2"
version = "0.3.3"
description = "A library to simplify model deployment to Vertex AI"
authors = ["Alexey Zankevich <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 28d7524

Please sign in to comment.