Stable diffusion
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 StableDiffusionPipeline
from wandb_addons.diffusers import get_wandb_callback
import torch
from diffusers import StableDiffusionPipeline
from wandb_addons.diffusers import get_wandb_callback
In [ ]:
Copied!
pipe = StableDiffusionPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4", torch_dtype=torch.float16
)
pipe = pipe.to("cuda")
pipe = StableDiffusionPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4", 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
num_inference_steps = 50
configs = {
"eta": 0.0,
"guidance_rescale": 0.0,
}
# Create the WandB callback for StableDiffusionPipeline
callback = get_wandb_callback(
pipe,
prompt=prompt,
negative_prompt=negative_prompt,
wandb_project="diffusers-new",
wandb_entity="geekyrakshit",
weave_mode=True,
num_inference_steps=num_inference_steps,
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_inference_steps=num_inference_steps,
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
num_inference_steps = 50
configs = {
"eta": 0.0,
"guidance_rescale": 0.0,
}
# Create the WandB callback for StableDiffusionPipeline
callback = get_wandb_callback(
pipe,
prompt=prompt,
negative_prompt=negative_prompt,
wandb_project="diffusers-new",
wandb_entity="geekyrakshit",
weave_mode=True,
num_inference_steps=num_inference_steps,
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_inference_steps=num_inference_steps,
num_images_per_prompt=num_images_per_prompt,
**configs,
)
In [ ]:
Copied!