Giter Club home page Giter Club logo

stable-diffusion-pokemon's Introduction


Stable-Diffusion-Pokemon

在宝可梦数据集(Pokemon-Blip-Captions)的英语、日语、中文版本上微调Stable Diffusion的示例

In English

简要引述

Stable Diffusion是现在一流的文本转图片生成模型。
现如今,借助于提供多模态能力的diffusers工程,人们可以自定义它们的条件或非条件图像(是否以文本提示作为条件)生成模型。
这个工程的目标是实现diffuser提供的基于lambdalabs/pokemon-blip-captionstext to image example微调任务,并将该任务迁移到日文及中文数据集上进行实践。
通过比较结论将会对Stable Diffusion在不同语言上的微调任务给出指导。 所有的代码都依据官方的train_text_to_image.py进行修改,并使得其对于中文和日文是有效的。 得到的三种语言的训练模型如下:English , JapaneseChinese.

安装和运行

运行install.sh将会安装所有的依赖并下载所有需要的模型(保证您注册并具有huggingface账号以及您的token 下载后可尝试运行run_en_model.py, run_ja_model.pyrun_zh_model.py

数据集准备

为了在日文及中文领域进行调试,我们需要将lambdalabs/pokemon-blip-captions。我已经使用 DeepL 对其进行翻译并上传至 huggingface dataset hub。分别位于 svjack/pokemon-blip-captions-en-jasvjack/pokemon-blip-captions-en-zh.

微调预训练模型

英文版本是一个仅仅将train_text_to_image.py的脚本由函数更改为notebook模式,位于train_en_model.py

日文版本使用rinnakk/japanese-stable-diffusion替换预训练模型,位于train_ja_model.py

中文版本使用IDEA-CCNL/Taiyi-CLIP-Roberta-102M-Chinese 替换预训练分词器以及文本编码器,并将BertForTokenClassification的logit输出进行padding来代替CLIPTextModel,位于train_zh_model.py

为了在推断阶段使得所有结果可见,我关闭了safety_checker。

生成器结果比较

Images
Prompt English Japanese Chinese
A cartoon character with a potted plant on his head

鉢植えの植物を頭に載せた漫画のキャラクター

一个头上戴着盆栽的卡通人物
Girl in a jacket Girl in a jacket Girl in a jacket
cartoon bird

漫画の鳥

卡通鸟
Girl in a jacket Girl in a jacket Girl in a jacket
blue dragon illustration

ブルードラゴンのイラスト

蓝色的龙图
Girl in a jacket Girl in a jacket Girl in a jacket

讨论

在英文、日文、中文下的预训练模型分别训练了26000, 26000 及 20000步。
对于训练结果的解释是这样的:rinnakk/japanese-stable-diffusion由于是日文的原生模型,所以含有很多宝可梦的特征。Stable Diffusion在英文领域微调的很好。IDEA-CCNL/Taiyi-CLIP-Roberta-102M-Chinese 如模型卡片所说在中文上能够起到基本的文本表征作用。

Contact

svjack - [email protected] - [email protected]

Project Link:https://github.com/svjack/Stable-Diffusion-Pokemon

Acknowledgements

stable-diffusion-pokemon's People

Contributors

svjack avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.