文本生成图片 Text-to-Image Generation

根据文本的描述创建相关图像。
Create relevant images based on the given text.

使用 Usage

Stable-Diffusion

全精度 Full precision

from diffusers import StableDiffusionPipeline

pipe = StableDiffusionPipeline.from_pretrained("IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Chinese-v0.1").to("cuda")

prompt = '飞流直下三千尺,油画'
image = pipe(prompt, guidance_scale=7.5).images[0]  
image.save("飞流.png")

半精度 Half precision FP16 (CUDA)

添加 torch_dtype=torch.float16device_map="auto" 可以快速加载 FP16 的权重,以加快推理速度。 更多信息见 the optimization docs

# !pip install git+https://github.com/huggingface/accelerate
import torch
from diffusers import StableDiffusionPipeline
torch.backends.cudnn.benchmark = True
pipe = StableDiffusionPipeline.from_pretrained("IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Chinese-v0.1", torch_dtype=torch.float16)
pipe.to('cuda')

prompt = '飞流直下三千尺,油画'
image = pipe(prompt, guidance_scale=7.5).images[0]  
image.save("飞流.png")

Diffusion

使用示例见:https://github.com/IDEA-CCNL/Fengshenbang-LM/tree/main/fengshen/examples/disco_project

生成示例 Example

Taiyi-Stable-Diffusion-1B-Chinese-v0.1
Taiyi-Stable-Diffusion-1B-Chinese-EN-v0.1
Taiyi-Diffusion-532M-Nature-Chinese
Taiyi-Diffusion-532M-Cyberpunk-Chinese

引用 Citation

如果您在您的工作中使用了我们的模型,可以引用我们的论文

If you are using the resource for your work, please cite the our paper:

@article{fengshenbang,
  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},
  title     = {Fengshenbang 1.0: Being the Foundation of Chinese Cognitive Intelligence},
  journal   = {CoRR},
  volume    = {abs/2209.02970},
  year      = {2022}
}

也可以引用我们的网站:

You can also cite our website:

@misc{Fengshenbang-LM,
  title={Fengshenbang-LM},
  author={IDEA-CCNL},
  year={2021},
  howpublished={\url{https://github.com/IDEA-CCNL/Fengshenbang-LM}},
}