The first open source Chinese Stable diffusion, which was trained on 20M filtered Chinese image-text pairs.
We support a
Gradio Web UI to run Taiyi-Stable-Diffusion-1B-Chinese-v0.1:
Taiyi-Stable-Diffusion-Chinese
我们将
Noah-Wukong数据集(100M)和
Zero数据集(23M)用作预训练的数据集,先用
IDEA-CCNL/Taiyi-CLIP-RoBERTa-102M-ViT-L-Chinese对这两个数据集的图文对相似性进行打分,取CLIP Score大于0.2的图文对作为我们的训练集。 我们使用
IDEA-CCNL/Taiyi-CLIP-RoBERTa-102M-ViT-L-Chinese作为初始化的text encoder,冻住
stable-diffusion-v1-4(
论文)模型的其他部分,只训练text encoder,以便保留原始模型的生成能力且实现中文概念的对齐。该模型目前在0.2亿图文对上训练了一个epoch。 我们在 32 x A100 训练了大约100小时。该版本只是一个初步的版本,我们将持续优化并开源后续模型,欢迎交流。
We use
Noah-Wukong(100M) 和
Zero(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) greater than 0.2 as our Training set. We use
IDEA-CCNL/Taiyi-CLIP-RoBERTa-102M-ViT-L-Chinese 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
stable-diffusion-v1-4(
paper) model. It takes 100 hours to train this model based on 32 x A100. This model is a preliminary version and we will update this model continuously and open sourse. Welcome to exchange!
1from diffusers import StableDiffusionPipeline
2
3pipe = StableDiffusionPipeline.from_pretrained("IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Chinese-v0.1").to("cuda")
4
5prompt = '飞流直下三千尺,油画'
6image = pipe(prompt, guidance_scale=7.5).images[0]
7image.save("飞流.png")
添加
torch_dtype=torch.float16 和
device_map="auto" 可以快速加载 FP16 的权重,以加快推理速度。
更多信息见
the optimization docs。
1# !pip install git+https://github.com/huggingface/accelerate
2import torch
3from diffusers import StableDiffusionPipeline
4torch.backends.cudnn.benchmark = True
5pipe = StableDiffusionPipeline.from_pretrained("IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Chinese-v0.1", torch_dtype=torch.float16)
6pipe.to('cuda')
7
8prompt = '飞流直下三千尺,油画'
9image = pipe(prompt, guidance_scale=7.5).images[0]
10image.save("飞流.png")
如果您在您的工作中使用了我们的模型,可以引用我们的
总论文:
If you are using the resource for your work, please cite the our
paper:
1@article{fengshenbang,
2 author = {Jiaxing Zhang and Ruyi Gan and 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},
3 title = {Fengshenbang 1.0: Being the Foundation of Chinese Cognitive Intelligence},
4 journal = {CoRR},
5 volume = {abs/2209.02970},
6 year = {2022}
7}
1@misc{Fengshenbang-LM,
2 title={Fengshenbang-LM},
3 author={IDEA-CCNL},
4 year={2021},
5 howpublished={\url{https://github.com/IDEA-CCNL/Fengshenbang-LM}},
6}