How to run your code?

#1
by Andyrasika - opened

i tried

from transformers import CLIPTextModel, CLIPTokenizer
from diffusers import AutoencoderKL, UNet2DConditionModel, PNDMScheduler
from diffusers.utils import load_image, make_image_grid
import torch

# Send the model to GPU to speed up inference
device = "cuda" if torch.cuda.is_available() else "cpu"
# Load processor and main model
pipeline = UNet2DConditionModel.from_pretrained("sayakpaul/mgie", torch_dtype=torch.float16, use_safetensors=True)

# pipeline.enable_model_cpu_offload()
# # remove following line if xFormers is not installed or you have PyTorch 2.0 or higher installed
# pipeline.enable_xformers_memory_efficient_attention()

init_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")

prompt = "cat in the futristic city with flying cars"
image = pipeline(prompt, image=init_image).images[0]
make_image_grid([init_image, image], rows=1, cols=2)

but got error:
```

TypeError Traceback (most recent call last)
in <cell line: 2>()
1 prompt = "cat in the futristic city with flying cars"
----> 2 image = pipeline(prompt, image=init_image).images[0]
3 make_image_grid([init_image, image], rows=1, cols=2)

1 frames
/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py in _call_impl(self, *args, **kwargs)
1525 or _global_backward_pre_hooks or _global_backward_hooks
1526 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1527 return forward_call(*args, **kwargs)
1528
1529 try:

TypeError: UNet2DConditionModel.forward() got an unexpected keyword argument 'image'
```

I have detailed the README of this repository.

Sign up or log in to comment