Skip to content

Commit c9b6b8b

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
feat: Support referenced models in SDK.
PiperOrigin-RevId: 623654808
1 parent 2d43438 commit c9b6b8b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

google/cloud/aiplatform/models.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -3251,7 +3251,9 @@ def upload(
32513251
container_spec = local_model.get_serving_container_spec()
32523252
appended_user_agent = [prediction_constants.CUSTOM_PREDICTION_ROUTINES]
32533253
else:
3254-
if not serving_container_image_uri:
3254+
# Referenced models do not have container_image and artifact_uri
3255+
# Skip the container_image if this is a referenced model
3256+
if not serving_container_image_uri and artifact_uri:
32553257
raise ValueError(
32563258
"The parameter `serving_container_image_uri` is required "
32573259
"if no `local_model` is provided."

tests/unit/aiplatform/test_models.py

+1
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,7 @@ def test_upload_without_serving_container_image_uri_throw_error(
12931293
display_name=_TEST_MODEL_NAME,
12941294
serving_container_predict_route=_TEST_SERVING_CONTAINER_PREDICTION_ROUTE,
12951295
serving_container_health_route=_TEST_SERVING_CONTAINER_HEALTH_ROUTE,
1296+
artifact_uri=_TEST_ARTIFACT_URI,
12961297
)
12971298

12981299
assert str(exception.value) == expected_message

0 commit comments

Comments
 (0)