transforms not defined
Trying to run code from model card, getting this error: NameError: name 'transforms' is not defined
My colab looks like this:
!pip install -qqq diffusers==0.10.2 transformers
from diffusers import StableDiffusionImageVariationPipeline
from PIL import Image
device = "cuda:0"
sd_pipe = StableDiffusionImageVariationPipeline.from_pretrained(
"lambdalabs/sd-image-variations-diffusers",
revision="v2.0",
)
sd_pipe = sd_pipe.to(device)
im = Image.open("/content/IMG_5018.png")
tform = transforms.Compose([
transforms.ToTensor(),
transforms.Resize(
(224, 224),
interpolation=transforms.InterpolationMode.BICUBIC,
antialias=False,
),
transforms.Normalize(
[0.48145466, 0.4578275, 0.40821073],
[0.26862954, 0.26130258, 0.27577711]),
])
inp = tform(im).to(device).unsqueeze(0)
out = sd_pipe(inp, guidance_scale=3)
out["images"][0].save("result.jpg")
Hi, for me to get it working I had to add this to the imports
import torchvision.transforms as transforms
then I had to change the device (i don't have a nvidia gpu)
device = "cpu"
Hope this helps you get it working!
Great Wolf Lodge