Views
No views yet


1from huggingface_hub import hf_hub_download
2from kandinsky3 import get_T2I_unet, get_T5encoder, get_movq, Kandinsky3T2IPipeline
3
4unet_path = hf_hub_download(
5 repo_id="ai-forever/Kandinsky3.0", filename='weights/kandinsky3.pt')
6)
7
8movq_path = hf_hub_download(
9 repo_id="ai-forever/Kandinsky3.0", filename='weights/movq.pt')
10)
11unet, null_embedding, projections_state_dict = get_T2I_unet(device, unet_path, fp16=fp16)
12processor, condition_encoders = get_T5encoder(device, text_encode_path, projections_state_dict, fp16=fp16)
13movq = get_movq(device, movq_path, fp16=fp16)
14t2i_pipe = Kandinsky3T2IPipeline(device, unet, null_embedding, processor, condition_encoders, movq, fp16=fp16)1from huggingface_hub import hf_hub_download
2from kandinsky3 import get_inpainting_unet, get_T5encoder, get_movq, Kandinsky3InpaintingPipeline
3
4inpainting_unet_path = hf_hub_download(
5 repo_id="ai-forever/Kandinsky3.0", filename='weights/kandinsky3_inpainting.pt', cache_dir=cache_dir
6)
7movq_path = hf_hub_download(
8 repo_id="ai-forever/Kandinsky3.0", filename='weights/movq.pt')
9)
10
11unet, null_embedding, projections_state_dict = get_inpainting_unet(device, unet_path, fp16=fp16)
12processor, condition_encoders = get_T5encoder(device, text_encode_path, projections_state_dict, fp16=fp16)
13movq = get_movq(device, movq_path, fp16=False) #MoVQ ooesn't work properly in fp16 on inpainting
14pipe = Kandinsky3InpaintingPipeline(device, unet, null_embedding, processor, condition_encoders, movq, fp16=fp16)conda create -n kandinsky -y python=3.8;
source activate kandinsky;
pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu113/torch_stable.html;
pip install -r requirements.txt;pip freeze and can be found in exact_requirements.txt./examples folder1from kandinsky3 import get_T2I_pipeline
2
3t2i_pipe = get_T2I_pipeline('cuda', fp16=True)
4
5image = t2i_pipe( "A cute corgi lives in a house made out of sushi.")1from kandinsky3 import get_inpainting_pipeline
2
3inp_pipe = get_inpainting_pipeline('cuda', fp16=True)
4
5image = ... # PIL Image
6mask = ... # Numpy array (HxW). Set 1 where image should be masked
7image = inp_pipe( "A cute corgi lives in a house made out of sushi.", image, mask)![]() | ![]() | ![]() | ![]() |
| "A beautiful landscape outdoors scene in the crochet knitting art style, drawing in style by Alfons Mucha" | "gorgeous phoenix, cosmic, darkness, epic, cinematic, moonlight, stars, high - definition, texture,Oscar-Claude Monet" | "a yellow house at the edge of the danish fjord, in the style of eiko ojala, ingrid baars, ad posters, mountainous vistas, george ault, realistic details, dark white and dark gray, 4k" | "dragon fruit head, upper body, realistic, illustration by Joshua Hoffine Norman Rockwell, scary, creepy, biohacking, futurism, Zaha Hadid style" |
![]() | ![]() | ![]() | ![]() |
| "Amazing playful nice cute strawberry character, dynamic poze, surreal fantazy garden background, gorgeous masterpice, award winning photo, soft natural lighting, 3d, Blender, Octane render, tilt - shift, deep field, colorful, I can't believe how beautiful this is, colorful, cute and sweet baby - loved photo" | "beautiful fairy-tale desert, in the sky a wave of sand merges with the milky way, stars, cosmism, digital art, 8k" | "Car, mustang, movie, person, poster, car cover, person, in the style of alessandro gottardo, gold and cyan, gerald harvey jones, reflections, highly detailed illustrations, industrial urban scenes"" | "cloud in blue sky, a red lip, collage art, shuji terayama, dreamy objects, surreal, criterion collection, showa era, intricate details, mirror" |