orient_express 2.1.2__tar.gz → 2.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. {orient_express-2.1.2 → orient_express-2.1.3}/PKG-INFO +1 -1
  2. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/vertex.py +9 -8
  3. {orient_express-2.1.2 → orient_express-2.1.3}/pyproject.toml +1 -1
  4. {orient_express-2.1.2 → orient_express-2.1.3}/README.md +0 -0
  5. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/__init__.py +0 -0
  6. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/deployment.py +0 -0
  7. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/model_wrapper.py +0 -0
  8. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/predictors/__init__.py +0 -0
  9. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/predictors/classification.py +0 -0
  10. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/predictors/instance_segmentation.py +0 -0
  11. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/predictors/multi_label_classification.py +0 -0
  12. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/predictors/object_detection.py +0 -0
  13. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/predictors/predictor.py +0 -0
  14. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/predictors/semantic_segmentation.py +0 -0
  15. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/sklearn_pipeline.py +0 -0
  16. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/utils/colors.py +0 -0
  17. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/utils/gs.py +0 -0
  18. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/utils/image_processor.py +0 -0
  19. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/utils/paths.py +0 -0
  20. {orient_express-2.1.2 → orient_express-2.1.3}/orient_express/utils/retry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orient_express
3
- Version: 2.1.2
3
+ Version: 2.1.3
4
4
  Summary: A library to simplify model deployment to Vertex AI
5
5
  Author: Alexey Zankevich
6
6
  Author-email: alex.zankevich@shiftsmart.com
@@ -76,13 +76,15 @@ class VertexModel:
76
76
  predictions = self.endpoint.predict(instances=instances, parameters=parameters)
77
77
  return predictions.predictions
78
78
 
79
- def get_local_predictor(self, device: str = "cpu"):
79
+ def get_local_predictor(self, device: str = "cpu", force_download: bool = False):
80
80
  dir = os.path.join(ARTIFACT_DIR, self.model_name + "-" + str(self.version))
81
- self.download_artifacts(dir)
81
+ self.download_artifacts(dir, force_download=force_download)
82
82
  return get_predictor(dir, device)
83
83
 
84
- def download_artifacts(self, dir: str):
85
- download_artifacts(dir, self.vertex_model.gca_resource.artifact_uri)
84
+ def download_artifacts(self, dir: str, force_download: bool = True):
85
+ download_artifacts(
86
+ dir, self.vertex_model.gca_resource.artifact_uri, force_download
87
+ )
86
88
 
87
89
 
88
90
  def vertex_init(project_name: str, region: str):
@@ -92,18 +94,17 @@ def vertex_init(project_name: str, region: str):
92
94
  _vertex_initialized = True
93
95
 
94
96
 
95
- def download_artifacts(dir: str, artifact_uri: str):
97
+ def download_artifacts(dir: str, artifact_uri: str, force_download: bool = True):
96
98
  storage_client = storage.Client()
97
-
98
99
  bucket_name, artifact_path = artifact_uri.replace("gs://", "").split("/", 1)
99
100
  bucket = storage_client.bucket(bucket_name)
100
-
101
101
  os.makedirs(dir, exist_ok=True)
102
-
103
102
  blobs = bucket.list_blobs(prefix=artifact_path)
104
103
  for blob in blobs:
105
104
  filename = blob.name.split("/")[-1]
106
105
  download_path = os.path.join(dir, filename)
106
+ if not force_download and os.path.exists(download_path):
107
+ continue
107
108
  blob.download_to_filename(download_path)
108
109
 
109
110
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "orient_express"
3
- version = "2.1.2"
3
+ version = "2.1.3"
4
4
  description = "A library to simplify model deployment to Vertex AI"
5
5
  authors = ["Alexey Zankevich <alex.zankevich@shiftsmart.com>", "Ian Myers <ian.myers@shiftsmart.com>"]
6
6
  readme = "README.md"
File without changes