xiayu commited on
Commit
45bdd7d
1 Parent(s): 8eacc10

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +120 -0
README.md ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: creativeml-openrail-m
3
+
4
+ tags:
5
+ - stable-diffusion
6
+ - stable-diffusion-diffusers
7
+ - text-to-image
8
+ - chinese
9
+
10
+ inference: false
11
+ extra_gated_prompt: |-
12
+ One more step before getting this model.
13
+ This model is open access and available to all, with a CreativeML OpenRAIL-M license further specifying rights and usage.
14
+ The CreativeML OpenRAIL License specifies:
15
+
16
+ 1. You can't use the model to deliberately produce nor share illegal or harmful outputs or content
17
+ 2. IDEA-CCNL claims no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in the license
18
+ 3. You may re-distribute the weights and use the model commercially and/or as a service. If you do, please be aware you have to include the same use restrictions as the ones in the license and share a copy of the CreativeML OpenRAIL-M to all your users (please read the license entirely and carefully)
19
+ Please read the full license here: https://huggingface.co/spaces/CompVis/stable-diffusion-license
20
+
21
+ By clicking on "Access repository" below, you accept that your *contact information* (email address and username) can be shared with the model authors as well.
22
+ extra_gated_fields:
23
+ I have read the License and agree with its terms: checkbox
24
+ ---
25
+
26
+ # Taiyi-Stable-Diffusion-1B-Chinese-v0.1
27
+
28
+ - Github: [Fengshenbang-LM](https://github.com/IDEA-CCNL/Fengshenbang-LM)
29
+ - Docs: [Fengshenbang-Docs](https://fengshenbang-doc.readthedocs.io/)
30
+
31
+ ## 简介 Brief Introduction
32
+
33
+ 首个开源的中英双语Stable Diffusion模型,基于0.2亿筛选过的中文图文对训练。
34
+
35
+ The first open source Chinese&English Bilingual Stable diffusion, which was trained on 20M filtered Chinese image-text pairs.
36
+
37
+ ## 模型分类 Model Taxonomy
38
+
39
+ | 需求 Demand | 任务 Task | 系列 Series | 模型 Model | 参数 Parameter | 额外 Extra |
40
+ | :----: | :----: | :----: | :----: | :----: | :----: |
41
+ | 特殊 Special | 多模态 Multimodal | 太乙 Taiyi | Stable Diffusion | 1B | Bilingual |
42
+
43
+ ## 模型信息 Model Information
44
+
45
+ 我们将[Noah-Wukong](https://wukong-dataset.github.io/wukong-dataset/)数据集(100M)和[Zero](https://zero.so.com/)数据集(23M)用作预训练的数据集,先用[IDEA-CCNL/Taiyi-CLIP-RoBERTa-102M-ViT-L-Chinese](https://huggingface.co/IDEA-CCNL/Taiyi-CLIP-RoBERTa-102M-ViT-L-Chinese)对这两个数据集的图文对相似性进行打分,取CLIP Score大于0.2的图文对作为我们的训练集。 我们使用[openai/clip-vit-large-patch14](https://huggingface.co/openai/clip-vit-large-patch14)作为初始化的text encoder,第一个stage中冻住模型的其他部分,只训练text encoder,以便保留原始模型的生成能力且实现中文概念的对齐。第二个stage中将全部模型解冻,一起训练text encoder和diffusion model,以便diffusion model更好的适配中文guidance。第一个stage我们训练了80小时,第二个stage训练了100小时,两个stage都是用了8 x A100。该版本只是一个很初步的版本,我们将持续优化模型。
46
+
47
+ We use [Noah-Wukong](https://wukong-dataset.github.io/wukong-dataset/)(100M) 和 [Zero](https://zero.so.com/)(23M) as our dataset, and take the image and text pairs with CLIP Score (based on [IDEA-CCNL/Taiyi-CLIP-RoBERTa-102M-ViT-L-Chinese](https://huggingface.co/IDEA-CCNL/Taiyi-CLIP-RoBERTa-102M-ViT-L-Chinese)) greater than 0.2 as our Training set. We use [openai/clip-vit-large-patch14](https://huggingface.co/openai/clip-vit-large-patch14) as our init text encoder. To keep the powerful generative capability of stable diffusion and align Chinese concepts with the images, We only train the text encoder and freeze other part of the model in the first stage. In the second stage, we unfreeze both the text encoder and the diffusion model, therefore the diffusion model can have a better compatibility for the Chinese language guidance. It takes 80 hours to train the first stage, 100 hours to train the second stage, both stages are based on 8 x A100. This model is a preliminary version and we will update this model continuously.
48
+
49
+ ### Result
50
+
51
+ 小桥流水人家,Van Gogh style。
52
+ ![](result_examples/xiaoqiao_vangogh.png)
53
+
54
+ 小桥流水人家,水彩。
55
+ ![](result_examples/xiaoqiao_oil_painting.png)
56
+
57
+ 吃过桥米线的猫。
58
+ ![](result_examples/cat_eating_guoqiao_noodle.png)
59
+
60
+ 穿着宇航服的哈士奇。
61
+ ![](result_examples/huskiy_wearing_space_suit.png)
62
+ ## 使用 Usage
63
+
64
+ ### 全精度 Full precision
65
+
66
+ ```py
67
+ from diffusers import StableDiffusionPipeline
68
+
69
+ pipe = StableDiffusionPipeline.from_pretrained("IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Bilingual-v0.1").to("cuda")
70
+
71
+ prompt = '小桥流水人家,van gogh style'
72
+ image = pipe(prompt, guidance_scale=10).images[0]
73
+ image.save("小桥.png")
74
+ ```
75
+
76
+ ### 半精度 Half precision FP16 (CUDA)
77
+
78
+ 添加 `torch_dtype=torch.float16` 和 `device_map="auto"` 可以快速加载 FP16 的权重,以加快推理速度。
79
+ 更多信息见 [the optimization docs](https://huggingface.co/docs/diffusers/main/en/optimization/fp16#half-precision-weights)。
80
+
81
+ ```py
82
+ # !pip install git+https://github.com/huggingface/accelerate
83
+ from diffusers import StableDiffusionPipeline
84
+
85
+ pipe = StableDiffusionPipeline.from_pretrained("IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Chinese-v0.1", torch_dtype=torch.float16, device_map="auto")
86
+
87
+ prompt = '小桥流水人家,van gogh style'
88
+ image = pipe(prompt, guidance_scale=10.0).images[0]
89
+ image.save("小桥.png")
90
+ ```
91
+
92
+
93
+ ## 引用 Citation
94
+
95
+ 如果您在您的工作中使用了我们的模型,可以引用我们的[论文](https://arxiv.org/abs/2209.02970):
96
+
97
+ If you are using the resource for your work, please cite the our [paper](https://arxiv.org/abs/2209.02970):
98
+
99
+ ```text
100
+ @article{fengshenbang,
101
+ author = {Junjie Wang and Yuxiang Zhang and Lin Zhang and Ping Yang and Xinyu Gao and Ziwei Wu and Xiaoqun Dong and Junqing He and Jianheng Zhuo and Qi Yang and Yongfeng Huang and Xiayu Li and Yanghan Wu and Junyu Lu and Xinyu Zhu and Weifeng Chen and Ting Han and Kunhao Pan and Rui Wang and Hao Wang and Xiaojun Wu and Zhongshen Zeng and Chongpei Chen and Ruyi Gan and Jiaxing Zhang},
102
+ title = {Fengshenbang 1.0: Being the Foundation of Chinese Cognitive Intelligence},
103
+ journal = {CoRR},
104
+ volume = {abs/2209.02970},
105
+ year = {2022}
106
+ }
107
+ ```
108
+
109
+ 也可以引用我们的[网站](https://github.com/IDEA-CCNL/Fengshenbang-LM/):
110
+
111
+ You can also cite our [website](https://github.com/IDEA-CCNL/Fengshenbang-LM/):
112
+
113
+ ```text
114
+ @misc{Fengshenbang-LM,
115
+ title={Fengshenbang-LM},
116
+ author={IDEA-CCNL},
117
+ year={2021},
118
+ howpublished={\url{https://github.com/IDEA-CCNL/Fengshenbang-LM}},
119
+ }
120
+ ```