Add image variation components #8

by williamberman HF staff - opened
No description provided.
williamberman changed pull request status to open

Let's check whether this work before merging :-)

Follow up from slack

from diffusers import UnCLIPPipeline, UnCLIPImageVariationPipeline

from PIL import Image

pipe = UnCLIPPipeline.from_pretrained("kakaobrain/karlo-v1-alpha", revision="refs/pr/8")
pipe.to('cuda')

images = pipe('a horse in downtown surrounded by sky scrapers', num_images_per_prompt=4).images

for i, image in enumerate(images):
    image.save(f'./image-{i}.png')


image = Image.open('./image-0.png')

pipe = UnCLIPImageVariationPipeline.from_pretrained("kakaobrain/karlo-v1-alpha", revision="refs/pr/8")
pipe.to('cuda')

images = pipe(image, num_images_per_prompt=4).images

for i, image in enumerate(images):
    image.save(f'./image-variation-{i}.png')

warns about safe tensors and config

$ python test.py 
image_encoder/model.safetensors not found
Fetching 23 files: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 23/23 [00:00<00:00, 30899.74it/s]
The config attributes {'feature_extractor': ['transformers', 'CLIPImageProcessor'], 'image_encoder': ['transformers', 'CLIPVisionModelWithProjection']} were passed to UnCLIPPipeline, but are not expected and will be ignored. Please verify your model_index.json configuration file.
Keyword arguments {'feature_extractor': ['transformers', 'CLIPImageProcessor'], 'image_encoder': ['transformers', 'CLIPVisionModelWithProjection']} are not expected by UnCLIPPipeline and will be ignored.
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 25/25 [00:02<00:00, 10.09it/s]
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00,  5.99it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:03<00:00,  2.13it/s]
image_encoder/model.safetensors not found
Fetching 23 files: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 23/23 [00:00<00:00, 35028.68it/s]
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 25/25 [00:03<00:00,  6.85it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:03<00:00,  2.13it/s]
williamberman changed pull request status to closed

Sign up or log in to comment