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

[Vertex AI] Add ImagenGenerationConfig to generateImages() #14234

Merged
merged 2 commits into from
Dec 9, 2024

Conversation

andrewheard
Copy link
Contributor

  • Added an ImagenGenerationConfig type for configuring image generation details (number of images, aspect ratio, image format, etc.) that is accepted in generateImages() calls.
  • Added ImagenAspectRatio and ImagenImageFormat types to limit the values to those accepted by the model. Updated the
  • Updated the integration test to check that the config is used.

#14221
#no-changelog

@google-oss-bot
Copy link

1 Warning
⚠️ New public headers were added, did you remember to add them to the umbrella header?

Generated by 🚫 Danger

Comment on lines +17 to +21
public var numberOfImages: Int?
public var negativePrompt: String?
public var aspectRatio: ImagenAspectRatio?
public var imageFormat: ImagenImageFormat?
public var addWatermark: Bool?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Still considering whether these should be mutable. It does make it significantly easier to adjust individual parameters and the config can be assigned to a let if the developer wants to keep them immutable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking aloud here... I've been thinking about what configuration types like this should look like in Swift 6. Here is my current thinking on the options:

  1. mark unchecked sendable and make each property atomic with a corresponding NSLock that guards a backing ivar (sync)
  2. Make the Config structure an actor (async)
  3. Mark the Config structure with a global actor (e.g. VertexAIActor) (async)
  4. Make a ConfigBuilder class that's an actor (or executes on global actor) that can build a immutable ImageGenerationConfig (async for the builder, sync for the produced value)

@andrewheard andrewheard marked this pull request as ready for review December 8, 2024 18:40
@andrewheard andrewheard requested a review from paulb777 December 9, 2024 14:18
@paulb777
Copy link
Member

paulb777 commented Dec 9, 2024

@ncooke3 Looks like this PR incorrectly triggered Firestore CI?

@ncooke3
Copy link
Member

ncooke3 commented Dec 9, 2024

@paulb777, I believe it's because the base branch, vertex-imagen, is not in-sync with main and is missing my infra PR.

@andrewheard
Copy link
Contributor Author

@paulb777, I believe it's because the base branch, vertex-imagen, is not in-sync with main and is missing my infra PR.

I'll merge main into vertex-imagen (or rebase if you'd prefer).

@andrewheard andrewheard merged commit 9d7b7f0 into vertex-imagen Dec 9, 2024
50 checks passed
@andrewheard andrewheard deleted the ah/vertex-imagen-generation-config branch December 9, 2024 15:21
@firebase firebase locked and limited conversation to collaborators Jan 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants