wx44wx commited on
Commit
5da5ebc
·
1 Parent(s): 7184577

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +74 -0
README.md CHANGED
@@ -1,3 +1,77 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ language:
4
+ - en
5
+ tags:
6
+ - stable-diffusion
7
+ - stable-diffusion-diffusers
8
+ - text-to-image
9
+ datasets:
10
+ - lambdalabs/three-kingdoms-blip-captions
11
  ---
12
+
13
+ __Stable Diffusion fine tuned on [Romance of the Three Kingdoms XI: Officer Portraits](https://kongming.net/11/portraits/).__
14
+
15
+ Put in a text prompt and generate your own Officier in Three Kingdoms.
16
+
17
+ trained using this [script](https://github.com/LambdaLabsML/examples/tree/main/stable-diffusion-finetuning) with this [dataset](https://huggingface.co/datasets/wx44wx/three-kingdoms-blip-captions).
18
+
19
+ > a man in armor
20
+ ![image.png](https://github.com/WangXin93/three-kingdoms-stable-diffusion/raw/main/assets/a-man-in-armor.png)
21
+
22
+ > a women in red dress
23
+ ![image.png](https://github.com/WangXin93/three-kingdoms-stable-diffusion/raw/main/assets/a-women-in-red-dress.png)
24
+
25
+ > a women in armor
26
+ ![image.png](https://github.com/WangXin93/three-kingdoms-stable-diffusion/raw/main/assets/a-women-in-armor.png)
27
+
28
+ try in [colab](https://colab.research.google.com/drive/1Wu_V-beDvLltrP4t6QURbb_8UDYYcUSC).
29
+
30
+ ## Usage
31
+
32
+ ```bash
33
+ !pip install diffusers==0.19.3
34
+ !pip install transformers scipy ftfy
35
+ ```
36
+
37
+ ```python
38
+ import torch
39
+ from diffusers import StableDiffusionPipeline
40
+ from torch import autocast
41
+
42
+ pipe = StableDiffusionPipeline.from_pretrained("wx44wx/sd-three-kingdoms-diffusers", torch_dtype=torch.float16)
43
+ pipe = pipe.to("cuda")
44
+
45
+ prompt = "a man in armor"
46
+ scale = 3
47
+ n_samples = 4
48
+
49
+ # Sometimes the nsfw checker is confused by the Pokémon images, you can disable
50
+ # it at your own risk here
51
+ disable_safety = False
52
+
53
+ if disable_safety:
54
+ def null_safety(images, **kwargs):
55
+ return images, False
56
+ pipe.safety_checker = null_safety
57
+
58
+ with autocast("cuda"):
59
+ images = pipe(n_samples*[prompt], guidance_scale=scale).images
60
+
61
+ for idx, im in enumerate(images):
62
+ im.save(f"{idx:06}.png")
63
+ ```
64
+
65
+ ## Model description
66
+
67
+ Trained on [BLIP captioned Three Kingdoms Officers images](https://huggingface.co/datasets/wx44wx/three-kingdoms-blip-captions) using 1xA6000 GPUs for around 16,000 steps.
68
+
69
+ ## Links
70
+
71
+ - [Lambda Diffusers](https://github.com/LambdaLabsML/lambda-diffusers)
72
+ - [Captioned Three Kingdoms dataset](https://huggingface.co/datasets/wx44wx/three-kingdoms-blip-captions)
73
+ - [Model weights in Diffusers format](https://huggingface.co/wx44wx/sd-three-kingdoms-diffusers)
74
+ - [Original model weights](https://huggingface.co/wx44wx/three-kingdoms-stable-diffusion)
75
+ - [Training code](https://github.com/justinpinkney/stable-diffusion)
76
+
77
+ Trained by [Xin Wang](wangxin93.github.io). Thanks [kongming.net](kongming.net) for their archived images and [justinpinkney](https://github.com/justinpinkney/stable-diffusion) for the code.