Skip to content

Commit cd167b8

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
chore: Add PyTorch first-party images to prediction first-party uris and allow PyTorch artifacts.
PiperOrigin-RevId: 496359092
1 parent da329d9 commit cd167b8

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

google/cloud/aiplatform/constants/prediction.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
CONTAINER_URI_REGEX = (
2626
r"^(us|europe|asia)-docker.pkg.dev/"
2727
r"vertex-ai/prediction/"
28-
r"(tf|sklearn|xgboost).+$"
28+
r"(tf|sklearn|xgboost|pytorch).+$"
2929
)
3030

3131
SKLEARN = "sklearn"
@@ -147,8 +147,20 @@
147147
"asia-docker.pkg.dev/vertex-ai/prediction/tf-gpu.1-15:latest",
148148
]
149149

150+
PYTORCH_CONTAINER_URIS = [
151+
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.1-11:latest",
152+
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.1-11:latest",
153+
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.1-11:latest",
154+
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.1-11:latest",
155+
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.1-11:latest",
156+
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.1-11:latest",
157+
]
158+
150159
SERVING_CONTAINER_URIS = (
151-
SKLEARN_CONTAINER_URIS + TF_CONTAINER_URIS + XGBOOST_CONTAINER_URIS
160+
SKLEARN_CONTAINER_URIS
161+
+ TF_CONTAINER_URIS
162+
+ XGBOOST_CONTAINER_URIS
163+
+ PYTORCH_CONTAINER_URIS
152164
)
153165

154166
# Map of all first-party prediction containers

google/cloud/aiplatform/models.py

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"model.pkl",
8989
"model.joblib",
9090
"model.bst",
91+
"model.mar",
9192
"saved_model.pb",
9293
"saved_model.pbtxt",
9394
]

tests/unit/aiplatform/test_helpers.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@ def test_correct_prediction_uri_args_with_init_location(self):
109109
"args, expected_error_msg",
110110
[
111111
(
112-
("pytorch", "1.10", None, None),
113-
"No containers found for framework `pytorch`. Supported frameworks are",
112+
("pytorch", "1.0", None, None),
113+
(
114+
"No serving container for `pytorch` version `1.0` with accelerator "
115+
"`cpu` found. Supported versions include"
116+
),
114117
),
115118
(
116119
("tensorflow", "9.15", None, None),
@@ -177,6 +180,10 @@ def test_invalid_prediction_uri_args(self, args, expected_error_msg):
177180
),
178181
(
179182
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.1-0:latest",
183+
True,
184+
),
185+
(
186+
"europe-docker.pkg.dev/vertex-ai/prediction/onnx-cpu.1-0:latest",
180187
False,
181188
),
182189
(

0 commit comments

Comments
 (0)