Skip to content

Commit

Permalink
feat: LVM - Released ImageCaptioningModel to GA
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 556991273
  • Loading branch information
Ark-kun authored and copybara-github committed Aug 15, 2023
1 parent 593b54f commit 7575046
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/system/aiplatform/test_vision_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from google.cloud import aiplatform
from tests.system.aiplatform import e2e_base
from vertexai import vision_models as ga_vision_models
from vertexai.preview import vision_models
from PIL import Image as PIL_Image

Expand All @@ -45,7 +46,7 @@ class VisionModelTestSuite(e2e_base.TestEndToEnd):
def test_image_captioning_model_get_captions(self):
aiplatform.init(project=e2e_base._PROJECT, location=e2e_base._LOCATION)

model = vision_models.ImageCaptioningModel.from_pretrained("imagetext")
model = ga_vision_models.ImageCaptioningModel.from_pretrained("imagetext")
image = _create_blank_image()
captions = model.get_captions(
image=image,
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/aiplatform/test_vision_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from google.cloud.aiplatform.compat.types import (
publisher_model as gca_publisher_model,
)
from vertexai import vision_models as ga_vision_models
from vertexai.preview import vision_models

from PIL import Image as PIL_Image
Expand Down Expand Up @@ -102,7 +103,9 @@ def test_get_captions(self):
attribute="get_publisher_model",
return_value=gca_publisher_model(_IMAGE_TEXT_PUBLISHER_MODEL_DICT),
):
model = vision_models.ImageCaptioningModel.from_pretrained("imagetext@001")
model = ga_vision_models.ImageCaptioningModel.from_pretrained(
"imagetext@001"
)

image_captions = [
"Caption 1",
Expand Down
25 changes: 25 additions & 0 deletions vertexai/vision_models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""Classes for working with vision models."""

from vertexai.vision_models._vision_models import (
Image,
ImageCaptioningModel,
)

__all__ = [
"Image",
"ImageCaptioningModel",
]

0 comments on commit 7575046

Please sign in to comment.