|
--- |
|
license: apache-2.0 |
|
--- |
|
|
|
|
|
### chinese-zodiac on stable diffuison by dreambooth |
|
|
|
|
|
#### new concept |
|
|
|
chinese-zodiac |
|
|
|
#### inference |
|
|
|
```` |
|
from torch import autocast |
|
from diffusers import StableDiffusionPipeline |
|
import torch |
|
import diffusers |
|
from PIL import Image |
|
|
|
|
|
def image_grid(imgs, rows, cols): |
|
assert len(imgs) == rows*cols |
|
w, h = imgs[0].size |
|
grid = Image.new('RGB', size=(cols*w, rows*h)) |
|
grid_w, grid_h = grid.size |
|
for i, img in enumerate(imgs): |
|
grid.paste(img, box=(i%cols*w, i//cols*h)) |
|
return grid |
|
|
|
|
|
pipe = StableDiffusionPipeline.from_pretrained("Dushwe/chinese-zodiac").to("cuda") |
|
prompt = 'A mountain tip in the clouds,chinese-zodiac' |
|
images = pipe(prompt, num_images_per_prompt=1, num_inference_steps=50, guidance_scale=7.5,torch_dtype=torch.cuda.HalfTensor).images |
|
grid = image_grid(images, 1, 1) |
|
grid |
|
```` |
|
![grid1](gen_imgs/0.png) |
|
|
|
#### generate samples |
|
crane under the tree,chinese-zodiac |
|
![grid2](gen_imgs/3.png) |
|
![grid3](gen_imgs/3-1.png) |
|
|
|
Chinese palace, 4k resolution, chinese-zodiac |
|
![grid4](gen_imgs/5.png) |
|
|
|
Moonlight,Mid-Autumn Festival,Moon,Silhouette,Lantern,White Rabbit,chinese-zodiac |
|
![grid5](gen_imgs/10.png) |
|
|
|
|
|
|
|
You run your new concept via `diffusers` |
|
[Colab Notebook for Inference](https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/sd_dreambooth_inference.ipynb). Don't forget to use the concept prompts! |
|
|
|
|