大概是Huggingface 🤗社区首个开源的Stable diffusion 2 中文模型。该模型基于
stable diffusion V2.1模型,在约500万条的中国风格筛选过的中文数据上进行微调,数据来源于多个开源数据集如
LAION-5B,
Noah-Wukong,
Zero和一些网络数据。
Probably the first open sourced Chinese Stable Diffusion 2 model in Huggingface🤗 community. This model is finetuned based on
stable diffusion V2.1 with 5M chinese style filtered data. Dataset is composed of several different chinese open source dataset such as
LAION-5B,
Noah-Wukong,
Zero and some web data.
Training on 5M chinese style filtered data for 150k steps. Exponential moving average(EMA) is applied to keep the original Stable Diffusion 2 drawing capability and reach a balance between chinese style and original drawing capability.
Customized Tokenizer should be loaded first with 'trust_remote_code=True'.
1import torch
2from diffusers import StableDiffusionPipeline
3from transformers import AutoTokenizer
4
5tokenizer_id = "lyua1225/clip-huge-zh-75k-steps-bs4096"
6sd2_id = "Midu/chinese-style-stable-diffusion-2-v0.1"
7tokenizer = AutoTokenizer.from_pretrained(tokenizer_id, trust_remote_code=True)
8pipe = StableDiffusionPipeline.from_pretrained(sd2_id, torch_dtype=torch.float16, tokenizer=tokenizer)
9pipe.to("cuda")
10
11image = pipe("赛博朋克风格的城市街道,8K分辨率,CG渲染", guidance_scale=10, num_inference_steps=20).images[0]
12image.save("cyberpunk.jpeg")
13