IDEA-CCNL / Fooocus-Taiyi-XL

支持Taiyi-Diffusion-XL模型的Fooocus
GNU General Public License v3.0
20 stars 2 forks source link

Fooocus适配Taiyi-XL模型 #5

Open ApolloRay opened 7 months ago

ApolloRay commented 7 months ago

从huggingface上下载的Taiyi-XL文件结构与SDXL一致。 请问tokenizer(2个) / text_encoder(2个)以及scheduler下的文件应该放到models下的那个文件下呢? gradio版本为3.41.2,但是sh run.sh的界面存在问题 截屏2024-01-31 21 21 50

ApolloRay commented 7 months ago

截屏2024-02-01 11 23 20 服务可以正常启动,gradio版本修改至3.43.2,但是界面显示依旧存在问题。

ApolloRay commented 7 months ago

gradio版本修改到4.0以上会报错 ImportError: cannot import name 'IOComponent' from 'gradio.components.base'

wxj630 commented 7 months ago

参考https://github.com/IDEA-CCNL/Fooocus-Taiyi-XL/issues/3

ApolloRay commented 7 months ago

目前的解决方案是git clone Fooocus的源代码,增加backend/module.extension/fooocus_extras可以解决展示页面无法点击generate的问题。 但是可以正常推理后,增加权重生图效果依然不符合预期。

截屏2024-02-01 19 00 01 截屏2024-02-01 19 00 13 截屏2024-02-01 19 00 31
ApolloRay commented 7 months ago
截屏2024-02-01 19 22 21
ApolloRay commented 7 months ago

At present, judging from the test results, the Chinese version does not match the propaganda effect in the paper, and there is a large difference.

wxj630 commented 7 months ago

请多尝试Fooocus里不同的风格, Please Try More Styles in the Fooocus!

就像我们在 https://huggingface.co/IDEA-CCNL/Taiyi-Stable-Diffusion-XL-3.5B modelcard说的那样,由于训练数据的数量、质量和多样性的限制,还有训练资源的限制,我们模型不够稳定,希望开源社区可以基于我们的方案进行进一步微调。

As we said in https://huggingface.co/IDEA-CCNL/Taiyi-Stable-Diffusion-XL-3.5B modelcard, due to the limitation of the quantity, quality and diversity of training data, as well as the limitations of training resources, we The model is not stable enough, and we hope that the open source community can further fine-tune it based on our solution.

下面是我今天刚尝试的一个例子,给出了风格和种子供大家复现效果。 Below is an example I just tried today, giving the style and seeds for everyone to reproduce the generated image.

2024-02-04_11-14-48_4644

2024-02-04_11-14-48_4644.png

Prompt: 一个宇航员骑着一匹(白马:1.5)

Negative Prompt:

Fooocus V2 Expansion: 一个宇航员骑着一匹(白马:1.5), surreal, beautiful, atmosphere, gorgeous, cinematic, dynamic, vibrant, intricate, highly detailed, very sharp focus, elegant,, futuristic, professional, light, color, epic, fine detail, clear, perfect, pretty, background

Styles: ['Fooocus V2', 'Fooocus Cinematic'], Performance: Speed

Resolution: (1216, 832), Sharpness: 0

Guidance Scale: 7, ADM Guidance: (1.5, 0.8, 0.3)

Base Model: taiyi_diffusion_xl.safetensors, Refiner Model: None

Refiner Switch: 0.5, Sampler: euler_ancestral

Scheduler: karras, Seed: 2127423485672861024

2277419213 commented 6 months ago

请问tokenizer(2个) / text_encoder(2个)以及scheduler下的文件应该放到models下的那个文件下呢?

wxj630 commented 5 months ago

我们发布训练代码了 we have released training codebase:

PiPiNam commented 4 months ago

请问tokenizer(2个) / text_encoder(2个)以及scheduler下的文件应该放到models下的那个文件下呢?

同问 请问这个问题您解决了吗

wxj630 commented 4 months ago

请问tokenizer(2个) / text_encoder(2个)以及scheduler下的文件应该放到models下的那个文件下呢?

同问 请问这个问题您解决了吗

一般只要在config.txt里的path_embeddings指定tokenizer,text_encoder和scheduler不用管,如果有什么错误可以贴下报错吗,我有时间会尽快解答

PiPiNam commented 4 months ago

20240520123940

@wxj630 您好,我通过命令行运行 python entry_with_update.py --listen --preset taiyi 的时候报出如上错误

1、config key加载出现问题 2、embeddings加载出现问题 3、现在前端gradio页面能够打开,但是点击生成没有反应,卡在”Waiting for task to start ...“

我的系统环境是win10,python3.10,按照要求安装了requirements的包,然后也将huggingface下载下来的taiyi_diffusion_xl.safetensors文件放到"./models/checkpoints/"下面了

请问应该如何解决上述三个问题呀?谢谢您!

wxj630 commented 4 months ago

20240520123940

@wxj630 您好,我通过命令行运行 python entry_with_update.py --listen --preset taiyi 的时候报出如上错误

1、config key加载出现问题 2、embeddings加载出现问题 3、现在前端gradio页面能够打开,但是点击生成没有反应,卡在”Waiting for task to start ...“

我的系统环境是win10,python3.10,按照要求安装了requirements的包,然后也将huggingface下载下来的taiyi_diffusion_xl.safetensors文件放到"./models/checkpoints/"下面了

请问应该如何解决上述三个问题呀?谢谢您!

config.txt的路径目前写的是我的绝对路径,都改成自己问价夹的路径

PiPiNam commented 4 months ago

@wxj630 感谢您的解答,您指的是Fooocus-Taiyi-XL文件夹根目录下的config.txt文件吗?

在config.txt中我没有发现里面有关于指定tokenizer的路径的命令。单我注意到上面的报错中有一句话warning, tokenizer path not specified, using default tokenizer,因此我通过全局搜索发现在Fooocus-Taiyi-XL\backend\headless\fcbh\sd1_clip.py 文件中 SDTokenizer 这个类初始化中使用了您指定的路径,因此我把这个路径改成了HuggingFace下载下来的Taiyi-Stable-Diffusion-XL-3.5B\tokenizer后可以正常加载tokenizer。

20240520141639

然而在加载完成之后,我试图在网页中输入中文”男孩“或者英文”boy“会报如下编码错误:

微信截图_20240520141945

请问这个问题该怎么解决呢? 期待您的解答!谢谢!

wxj630 commented 4 months ago

@wxj630 感谢您的解答,您指的是Fooocus-Taiyi-XL文件夹根目录下的config.txt文件吗?

在config.txt中我没有发现里面有关于指定tokenizer的路径的命令。单我注意到上面的报错中有一句话warning, tokenizer path not specified, using default tokenizer,因此我通过全局搜索发现在Fooocus-Taiyi-XL\backend\headless\fcbh\sd1_clip.py 文件中 SDTokenizer 这个类初始化中使用了您指定的路径,因此我把这个路径改成了HuggingFace下载下来的Taiyi-Stable-Diffusion-XL-3.5B\tokenizer后可以正常加载tokenizer。

20240520141639

然而在加载完成之后,我试图在网页中输入中文”男孩“或者英文”boy“会报如下编码错误:

微信截图_20240520141945

请问这个问题该怎么解决呢? 期待您的解答!谢谢!

看起来是在windows部署的时候遇到字符编码的小问题,试下modules/default_pipeline.py的第162行和164行改为:

with open("clip_l.json","w",encoding="utf-8") as f:
with open("clip_g.json","w",encoding="utf-8") as f:
PiPiNam commented 4 months ago

感谢您的解答! 根据您提供的方法已经成功解决该编码问题。

此外还有几个疑惑期望您可以帮忙解答: 1、从您提供的huggingface模型仓库,看到有text_encoder、text_encoder_2、tokenizer、tokenizer_2,请问encoder和tokenizer应该使用哪一个呢?

2、看到您在markdown文档中说的是将huggingface模型仓库中根目录下的taiyi_diffusion_xl.safetensors 移动至Fooocus-Taiyi-XL\models\checkpoints 目录下,请问从huggingface上下载下来的除了taiyi_diffusion_xl.safetensors文件之外的其余几个文件夹,如:scheduler、text_encoder、text_encoder_2、tokenizer、tokenizer_2、unet、vae 这7个文件夹里的文件应该放在那里进行使用呢?

3、请问一下.\Fooocus-Taiyi-XL\models\ 文件夹目录内有许多模型文件夹,如clip、clip_vision、embeddings、loras、unet、vae等文件夹,但文件夹都是空的,请问应该怎么处理呢?

wxj630 commented 4 months ago

感谢您的解答! 根据您提供的方法已经成功解决该编码问题。

此外还有几个疑惑期望您可以帮忙解答: 1、从您提供的huggingface模型仓库,看到有text_encoder、text_encoder_2、tokenizer、tokenizer_2,请问encoder和tokenizer应该使用哪一个呢?

2、看到您在markdown文档中说的是将huggingface模型仓库中根目录下的taiyi_diffusion_xl.safetensors 移动至Fooocus-Taiyi-XL\models\checkpoints 目录下,请问从huggingface上下载下来的除了taiyi_diffusion_xl.safetensors文件之外的其余几个文件夹,如:scheduler、text_encoder、text_encoder_2、tokenizer、tokenizer_2、unet、vae 这7个文件夹里的文件应该放在那里进行使用呢?

3、请问一下.\Fooocus-Taiyi-XL\models\ 文件夹目录内有许多模型文件夹,如clip、clip_vision、embeddings、loras、unet、vae等文件夹,但文件夹都是空的,请问应该怎么处理呢?

1、tokenizer/和tokenizer_2/其实是一样的,text_encoder/、text_encoder_2/已经包含在.safetensors里了两个都会用上,.safetensors是给fooocus使用的模型格式,分很多目录是给diffusers使用的模型格式,当然还是建议在fooocus下推理使用; 2、不用管,理由同1 3、可以去看下fooocus官方仓库的使用指南,简单来说推理的时候可以选择加一些“插件”达到不同的文生图效果,比如想要古风可以下载一个古风lora放到对应文件夹