miluELK commited on
Commit
097e745
1 Parent(s): fb7a974

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -2
README.md CHANGED
@@ -10,12 +10,35 @@ tags:
10
  - lora
11
  inference: true
12
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  # LoRA text2image fine-tuning - miluELK/Taiyi-sd-pokemon-LoRA-zh-512-v2
15
  These are LoRA adaption weights for IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Anime-Chinese-v0.1. The weights were fine-tuned on the svjack/pokemon-blip-captions-en-zh dataset. You can find some example images in the following.
16
 
17
- ![img_0](./image_0.png)
18
  ![img_1](./image_1.png)
19
  ![img_2](./image_2.png)
20
- ![img_3](./image_3.png)
 
21
 
 
10
  - lora
11
  inference: true
12
  ---
13
+
14
+ use the following code to generate image
15
+ ```python
16
+ import os
17
+ from diffusers import StableDiffusionPipeline
18
+ import torch
19
+ import random
20
+
21
+ prompt="可爱的,黄色的老鼠,小精灵,卡通"
22
+ seed=random.randint(1,2147483647)
23
+ print(seed)
24
+ pipe = StableDiffusionPipeline.from_pretrained("IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Anime-Chinese-v0.1",
25
+ torch_dtype=torch.float16,)
26
+ model_path = "miluELK/Taiyi-sd-pokemon-LoRA-zh-512-v2"
27
+
28
+ pipe.unet.load_attn_procs(model_path)
29
+ pipe.to("cuda")
30
+ generator = torch.Generator("cuda").manual_seed(seed)
31
+ pipe.safety_checker = lambda images, clip_input: (images, False)
32
+ image = pipe(prompt, generator=generator, num_inference_steps=50, guidance_scale=7.5).images[0]
33
+ image.save("./" + prompt + ".png")
34
+ image
35
+ ```
36
 
37
  # LoRA text2image fine-tuning - miluELK/Taiyi-sd-pokemon-LoRA-zh-512-v2
38
  These are LoRA adaption weights for IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Anime-Chinese-v0.1. The weights were fine-tuned on the svjack/pokemon-blip-captions-en-zh dataset. You can find some example images in the following.
39
 
 
40
  ![img_1](./image_1.png)
41
  ![img_2](./image_2.png)
42
+ ![img_3](./image3.png)
43
+ ![img_4](./image4.png)
44