Kandinsky
In [ ]:
Copied!
# !git clone https://github.com/soumik12345/wandb-addons
# !pip install ./wandb-addons[huggingface]
# !git clone https://github.com/soumik12345/wandb-addons
# !pip install ./wandb-addons[huggingface]
In [ ]:
Copied!
import torch
from diffusers import KandinskyCombinedPipeline
from wandb_addons.diffusers import KandinskyCallback
import torch
from diffusers import KandinskyCombinedPipeline
from wandb_addons.diffusers import KandinskyCallback
In [ ]:
Copied!
pipe = KandinskyCombinedPipeline.from_pretrained(
"kandinsky-community/kandinsky-2-1", torch_dtype=torch.float16
)
pipe = pipe.to("cuda")
pipe = KandinskyCombinedPipeline.from_pretrained(
"kandinsky-community/kandinsky-2-1", torch_dtype=torch.float16
)
pipe = pipe.to("cuda")
In [ ]:
Copied!
prompt = ["a photograph of an astronaut riding a horse", "a photograph of a dragon"]
negative_prompt = ["ugly, deformed", "ugly, deformed"]
num_images_per_prompt = 2
configs = {
"guidance_scale": 4.0,
"height": 512,
"width": 512,
"prior_guidance_scale": 4.0,
"prior_num_inference_steps": 25,
}
# Create the WandB callback for StableDiffusionPipeline
callback = KandinskyCallback(
pipe,
prompt=prompt,
negative_prompt=negative_prompt,
wandb_project="diffusers",
wandb_entity="geekyrakshit",
weave_mode=False,
num_images_per_prompt=num_images_per_prompt,
configs=configs,
)
# Add the callback to the pipeline
image = pipe(
prompt,
negative_prompt=negative_prompt,
callback=callback,
num_images_per_prompt=num_images_per_prompt,
**configs,
)
prompt = ["a photograph of an astronaut riding a horse", "a photograph of a dragon"]
negative_prompt = ["ugly, deformed", "ugly, deformed"]
num_images_per_prompt = 2
configs = {
"guidance_scale": 4.0,
"height": 512,
"width": 512,
"prior_guidance_scale": 4.0,
"prior_num_inference_steps": 25,
}
# Create the WandB callback for StableDiffusionPipeline
callback = KandinskyCallback(
pipe,
prompt=prompt,
negative_prompt=negative_prompt,
wandb_project="diffusers",
wandb_entity="geekyrakshit",
weave_mode=False,
num_images_per_prompt=num_images_per_prompt,
configs=configs,
)
# Add the callback to the pipeline
image = pipe(
prompt,
negative_prompt=negative_prompt,
callback=callback,
num_images_per_prompt=num_images_per_prompt,
**configs,
)