Skip to content

Commit 070f286

Browse files
committed
Google Cloud - Vertex_AI - Models - Upload_Scikit-learn_pickle_model - Simplified the component after my Vertex SDK fixes were merged
Some of my Vertex SDK fixes: googleapis/python-aiplatform#779 googleapis/python-aiplatform#882 googleapis/python-aiplatform#943 googleapis/python-aiplatform#997
1 parent 6af42e1 commit 070f286

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

components/google-cloud/Vertex_AI/Models/Upload_Scikit-learn_pickle_model/component.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@ def upload_Scikit_learn_pickle_model_to_Google_Cloud_Vertex_AI(
1818
# explanation_parameters: "google.cloud.aiplatform_v1.types.explanation.ExplanationParameters" = None,
1919

2020
project: str = None,
21-
location: str = "us-central1",
21+
location: str = None,
2222
labels: dict = None,
2323
# encryption_spec_key_name: str = None,
2424
staging_bucket: str = None,
2525
) -> NamedTuple("Outputs", [
2626
("model_name", "GoogleCloudVertexAiModelName"),
2727
("model_dict", dict),
2828
]):
29-
import datetime
3029
import json
3130
import os
3231
import shutil
@@ -45,8 +44,6 @@ def upload_Scikit_learn_pickle_model_to_Google_Cloud_Vertex_AI(
4544
_, renamed_model_path = tempfile.mkstemp(suffix=".pkl")
4645
shutil.copyfile(src=model_path, dst=renamed_model_path)
4746

48-
display_name = display_name or "Scikit-learn model " + datetime.datetime.now().isoformat(sep=" ")
49-
5047
model = aiplatform.Model.upload_scikit_learn_model_file(
5148
model_file_path=renamed_model_path,
5249
sklearn_version=sklearn_version,
@@ -82,8 +79,7 @@ def upload_Scikit_learn_pickle_model_to_Google_Cloud_Vertex_AI(
8279
func=upload_Scikit_learn_pickle_model_to_Google_Cloud_Vertex_AI,
8380
base_image="python:3.9",
8481
packages_to_install=[
85-
# "google-cloud-aiplatform==1.10.0",
86-
"git+https://github.com/Ark-kun/python-aiplatform@9b50f62b9d1409644656fb3202edc7be19c722f4#egg=google-cloud-aiplatform&subdirectory=." # branch: fix--Fixed-getitng-project-ID-when-running-on-Vertex-AI
82+
"google-cloud-aiplatform==1.16.0",
8783
],
8884
annotations={
8985
"author": "Alexey Volkov <[email protected]>",

components/google-cloud/Vertex_AI/Models/Upload_Scikit-learn_pickle_model/component.yaml

+4-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ inputs:
77
- {name: display_name, type: String, optional: true}
88
- {name: description, type: String, optional: true}
99
- {name: project, type: String, optional: true}
10-
- {name: location, type: String, default: us-central1, optional: true}
10+
- {name: location, type: String, optional: true}
1111
- {name: labels, type: JsonObject, optional: true}
1212
- {name: staging_bucket, type: String, optional: true}
1313
outputs:
@@ -20,9 +20,8 @@ implementation:
2020
- sh
2121
- -c
2222
- (PIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location
23-
'git+https://github.com/Ark-kun/python-aiplatform@9b50f62b9d1409644656fb3202edc7be19c722f4#egg=google-cloud-aiplatform&subdirectory=.'
24-
|| PIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location
25-
'git+https://github.com/Ark-kun/python-aiplatform@9b50f62b9d1409644656fb3202edc7be19c722f4#egg=google-cloud-aiplatform&subdirectory=.'
23+
'google-cloud-aiplatform==1.16.0' || PIP_DISABLE_PIP_VERSION_CHECK=1 python3
24+
-m pip install --quiet --no-warn-script-location 'google-cloud-aiplatform==1.16.0'
2625
--user) && "$0" "$@"
2726
- sh
2827
- -ec
@@ -46,12 +45,11 @@ implementation:
4645
# explanation_parameters: "google.cloud.aiplatform_v1.types.explanation.ExplanationParameters" = None,
4746
4847
project = None,
49-
location = "us-central1",
48+
location = None,
5049
labels = None,
5150
# encryption_spec_key_name: str = None,
5251
staging_bucket = None,
5352
):
54-
import datetime
5553
import json
5654
import os
5755
import shutil
@@ -70,8 +68,6 @@ implementation:
7068
_, renamed_model_path = tempfile.mkstemp(suffix=".pkl")
7169
shutil.copyfile(src=model_path, dst=renamed_model_path)
7270
73-
display_name = display_name or "Scikit-learn model " + datetime.datetime.now().isoformat(sep=" ")
74-
7571
model = aiplatform.Model.upload_scikit_learn_model_file(
7672
model_file_path=renamed_model_path,
7773
sklearn_version=sklearn_version,

0 commit comments

Comments
 (0)