Run this model with HF Jobs

Run lambda/sd-image-variations-diffusers on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/lambda/sd-image-variations-diffusers. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/lambda/sd-image-variations-diffusers on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

transforms not defined

#11
by terekita - opened

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

Sign up or log in to comment