🚀 太乙穩定擴散模型 1B 中文 v0.1
太乙穩定擴散模型 1B 中文 v0.1 是首個開源的中英雙語 Stable Diffusion 模型,基於 0.2 億篩選過的中文圖文對訓練,能夠根據文本描述生成高質量的圖像,為多模態應用提供了強大支持。
🚀 快速開始
全精度
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.float16
和 device_map="auto"
可以快速加載 FP16 的權重,以加快推理速度。更多信息見 the optimization docs。
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")
✨ 主要特性
- 首個開源的中英雙語 Stable Diffusion 模型,支持中文文本輸入生成圖像。
- 基於篩選過的 0.2 億中文圖文對訓練,對中文概念有更好的理解和生成能力。
- 提供全精度和半精度兩種推理方式,可根據需求選擇以平衡速度和精度。
📦 安裝指南
文檔中未提及具體安裝步驟,可參考使用示例中的代碼,確保安裝所需依賴庫,如 diffusers
、torch
等。
💻 使用示例
基礎用法
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")
高級用法
在半精度推理時,可添加 torch_dtype=torch.float16
和 device_map="auto"
加快推理速度。
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")
📚 詳細文檔
🔧 技術細節
我們將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 小時。該版本只是一個初步的版本,我們將持續優化並開源後續模型,歡迎交流。
📄 許可證
本模型採用 CreativeML OpenRAIL-M 許可證。在獲取此模型前,需瞭解以下信息:
- 不能使用該模型故意生成或分享非法或有害的輸出或內容。
- IDEA-CCNL 對生成的輸出不主張任何權利,用戶可自由使用,但需對其使用負責,且不得違反許可證中的規定。
- 可以重新分發模型權重,並將模型用於商業用途或作為服務。若這樣做,需包含與許可證相同的使用限制,並向所有用戶分享 CreativeML OpenRAIL-M 許可證副本。
請閱讀完整許可證:https://huggingface.co/spaces/CompVis/stable-diffusion-license
點擊“訪問倉庫”,即表示同意您的聯繫信息(電子郵件地址和用戶名)可與模型作者共享。
📋 模型分類
屬性 |
詳情 |
需求 |
特殊 |
任務 |
多模態 |
系列 |
太乙 |
模型 |
Stable Diffusion |
參數 |
1B |
額外 |
Chinese |
📷 模型生成結果示例
基礎提示
提示文本 |
生成圖像 |
鐵馬冰河入夢來,3D 繪畫。 |
 |
飛流直下三千尺,油畫。 |
 |
女孩背影,日落,唯美插畫。 |
 |
高級提示
提示文本 |
生成圖像 |
鐵馬冰河入夢來,概念畫,科幻,玄幻,3D |
 |
中國海邊城市,科幻,未來感,唯美,插畫。 |
 |
那人卻在燈火闌珊處,色彩豔麗,古風,資深插畫師作品,桌面高清壁紙。 |
 |
🔗 相關鏈接
📖 引用
如果您在工作中使用了我們的模型,可以引用我們的總論文:
@article{fengshenbang,
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},
title = {Fengshenbang 1.0: Being the Foundation of Chinese Cognitive Intelligence},
journal = {CoRR},
volume = {abs/2209.02970},
year = {2022}
}
也可以引用我們的網站:
@misc{Fengshenbang-LM,
title={Fengshenbang-LM},
author={IDEA-CCNL},
year={2021},
howpublished={\url{https://github.com/IDEA-CCNL/Fengshenbang-LM}},
}