Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imagen 3 - backward compatibility with the Imagen 2 API #4789

Open
catwell opened this issue Dec 13, 2024 · 0 comments
Open

Imagen 3 - backward compatibility with the Imagen 2 API #4789

catwell opened this issue Dec 13, 2024 · 0 comments
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API.

Comments

@catwell
Copy link

catwell commented Dec 13, 2024

Imagen 3 has been released but the documentation has not been updated yet and the new API is more generic but also more complex than the old one.

For instance, with Imagen 2 you can outcrop like this:

model = ImageGenerationModel.from_pretrained("imagegeneration@006")
images = model.edit_image(
    prompt=prompt,
    edit_mode="outpainting",
    base_image=base_img,
    mask=mask_img,
)

but with Imagen 3 you need to do this:

model = ImageGenerationModel.from_pretrained("imagen-3.0-capability-001")
base_ref = RawReferenceImage(
    reference_id=0,
    image=base_img,
)
mask_ref = MaskReferenceImage(
    reference_id=1,
    image=mask_img,
    mask_mode="user_provided",
    dilation=0.03,
)
images = model.edit_image(
    prompt=prompt,
    edit_mode="outpainting",
    reference_images=[base_ref, mask_ref],
    number_of_images=2,
)

(Note in particular the dilation parameter, which is important and set to the old default.)

I think it would make sense to keep supporting the simpler API by converting it to the new format in the SDK when using Imagen 3.

@product-auto-label product-auto-label bot added the api: vertex-ai Issues related to the googleapis/python-aiplatform API. label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API.
Projects
None yet
Development

No branches or pull requests

1 participant