wx44wx commited on
Commit
590eb27
1 Parent(s): f45d2bb

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +72 -0
README.md CHANGED
@@ -1,3 +1,75 @@
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
+ - wx44wx/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
+ ## Usage
29
+
30
+ ```bash
31
+ !pip install diffusers==0.19.3
32
+ !pip install transformers scipy ftfy
33
+ ```
34
+
35
+ ```python
36
+ import torch
37
+ from diffusers import StableDiffusionPipeline
38
+ from torch import autocast
39
+
40
+ pipe = StableDiffusionPipeline.from_pretrained("wx44wx/sd-three-kingdoms-diffusers", torch_dtype=torch.float16)
41
+ pipe = pipe.to("cuda")
42
+
43
+ prompt = "a man in armor"
44
+ scale = 3
45
+ n_samples = 4
46
+
47
+ # Sometimes the nsfw checker is confused by the Pokémon images, you can disable
48
+ # it at your own risk here
49
+ disable_safety = False
50
+
51
+ if disable_safety:
52
+ def null_safety(images, **kwargs):
53
+ return images, False
54
+ pipe.safety_checker = null_safety
55
+
56
+ with autocast("cuda"):
57
+ images = pipe(n_samples*[prompt], guidance_scale=scale).images
58
+
59
+ for idx, im in enumerate(images):
60
+ im.save(f"{idx:06}.png")
61
+ ```
62
+
63
+ ## Model description
64
+
65
+ 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.
66
+
67
+ ## Links
68
+
69
+ - [Lambda Diffusers](https://github.com/LambdaLabsML/lambda-diffusers)
70
+ - [Captioned Three Kingdoms dataset](https://huggingface.co/datasets/wx44wx/three-kingdoms-blip-captions)
71
+ - [Model weights in Diffusers format](https://huggingface.co/wx44wx/sd-three-kingdoms-diffusers)
72
+ - [Original model weights](https://huggingface.co/wx44wx/three-kingdoms-stable-diffusion)
73
+ - [Training code](https://github.com/justinpinkney/stable-diffusion)
74
+
75
+ 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.