Training and deployment of image generation models
In some embodiments, a method receives a text prompt. A text encoder is executed on the text prompt to generate a representation. The method generates a set of images based on the representation and a set of parameters of an image generation model. The set of images is ranked using reward values that are generated by a reward model. The reward model is trained using human input that provided feedback on a quality of generated images using the image generation model. The method outputs one or more images based on the ranking in response to the text prompt.
1 . A method comprising:
receiving a text prompt;
executing a text encoder on the text prompt to generate a representation;
generating a set of images based on the representation and a set of parameters of an image generation model;
ranking the set of images using reward values that are generated by a reward model, wherein the reward model is trained using human input that provided feedback on a quality of generated images using the image generation model; and
outputting one or more images based on the ranking in response to the text prompt.
2 . The method of claim 1 , wherein executing the text encoder comprises:
interpreting text of the text prompt to encode a semantic representation represented by the text in the representation.
3 . The method of claim 1 , wherein generating the set of images comprises:
initializing a random distribution of noise; and
iteratively denoise the random distribution of noise according to the parameters of the image generation model and a semantic representation of an image description encoded in the representation.
4 . The method of claim 1 , wherein executing the text encoder comprises:
generating multiple embedding representations in different embedding spaces using multiple text encoder models.
5 . The method of claim 4 , further comprising:
inputting the multiple text embedding representations into one or more image generation models to generate the set of images; and
ranking the set of images to select a subset of images as the set of images.
6 . The method of claim 1 , further comprising:
executing a high resolution model to upsample one or more base images based on parameters of the high resolution model to generate the set of images.
7 . The method of claim 6 , wherein executing the high resolution model comprises:
iteratively denoising the base image to progressively upsample the base image to a higher resolution.
8 . The method of claim 7 , wherein executing the high resolution model comprises:
upsampling visual aspects of the one or more base images generated by the image generation model.
9 . The method of claim 1 , further comprising:
training the image generation model to train the parameters for the image generation model.
10 . The method of claim 9 , wherein training the image generation model comprises:
receiving a set of training images and text captions describing training images in the set of training images;
executing the image generation model on the set of training images to train the set of parameters, wherein training the set of parameters comprises:
generating a first set of generated images based on the text captions;
comparing the first set of generated images to corresponding training images associated with the text captions;
adjusting the set of parameters of the image generation model based on the comparing to generate an adjusted set of parameters; and
generating a final set of parameters from the adjusted set of parameters based on reward values for a second set of generated images by the image generation model using the adjusted set of parameters, wherein the reward values are generated by a reward model that is trained using human input that provided feedback on a quality of the generated images.
11 . The method of claim 10 , wherein the set of training images comprises a first set of training images, the method further comprising:
receiving a second set of training images; and
removing images from the second set of training images to form the first set of training images, wherein images that are removed do not meet a threshold based on quality.
12 . The method of claim 10 , wherein executing the model on the set of training images to train the set of parameters comprises:
generating a set of representations for the set of training images; and
using the set of representations to generate a set of base images using the image generation model.
13 . The method of claim 12 , wherein executing the image generation model on the set of training images to train the set of parameters comprises:
training the set of parameters based on learning a correlation between text captions and associated base images.
14 . The method of claim 13 , wherein using the set of representations to generate base images comprises:
initializing a random distribution of noise for a base image in the set of base images;
iteratively denoise the random distribution of noise according to the set of parameters of the image generation model and a semantic representation of an image description encoded in the representation; and
iteratively training the set of parameters based on the iteratively denoising of the random distribution of noise.
15 . The method of claim 14 , wherein executing the image generation model on the set of training images to train the set of parameters comprises:
iteratively denoising the base image to progressively upsample the base image to a higher resolution according to a set of high resolution parameters of the image generation model; and
iteratively training the set of high resolution parameters based on the iteratively denoising of the base image.
16 . The method of claim 15 , wherein generating the final set of parameters from the set of parameters based on reward values for the generated images comprises:
generating a first generated image in the second set of generated images using the set of parameters of the image generation model;
generating a second generated image in the second set of generated images using the adjusted set of parameters of the image generation model;
generating a first reward value for the first generated image and a second reward value for the second generated image using the reward model;
generating a third reward value based on a difference between the first reward value and the second reward value; and
refining the adjusted set of parameters based on the third reward value.
17 . The method of claim 1 , wherein training the reward model comprises:
generating a reward value for a generated image;
comparing the reward value to feedback from the human input; and
adjusting one or more parameters of the reward model based on the comparing.
18 . The method of claim 1 , wherein ranking the set of images using reward values comprises:
analyzing the set of images;
computing a set of reward values for the set of images; and
ranking the set of images based on respective reward values of images in the set of images.
19 . A non-transitory computer-readable storage medium having stored thereon computer executable instructions, which when executed by a computing device, cause the computing device to be operable for:
receiving a text prompt;
executing a text encoder on the text prompt to generate a representation;
generating a set of images based on the representation and a set of parameters of an image generation model;
ranking the set of images using reward values that are generated by a reward model, wherein the reward model is trained using human input that provided feedback on a quality of generated images using the image generation model; and
outputting one or more images based on the ranking in response to the text prompt.
20 . An apparatus comprising:
one or more computer processors; and
a computer-readable storage medium comprising instructions for controlling the one or more computer processors to be operable for:
receiving a text prompt;
executing a text encoder on the text prompt to generate a representation;
generating a set of images based on the representation and a set of parameters of an image generation model;
ranking the set of images using reward values that are generated by a reward model, wherein the reward model is trained using human input that provided feedback on a quality of generated images using the image generation model; and
outputting one or more images based on the ranking in response to the text prompt.