PaddlePaddle / PaddleNLP

👑 Easy-to-use and powerful NLP and LLM library with 🤗 Awesome model zoo, supporting wide-range of NLP tasks from research to industrial applications, including 🗂Text Classification, 🔍 Neural Search, ❓ Question Answering, ℹ️ Information Extraction, 📄 Document Intelligence, 💌 Sentiment Analysis etc.
https://paddlenlp.readthedocs.io
Apache License 2.0
11.73k stars 2.87k forks source link

[Question]: 请问在 ppdiffuser 内,如何加载多个 lora,然后使用 prompt 进行切换? #6558

Open ViewWholeWorld opened 11 months ago

ViewWholeWorld commented 11 months ago

请提出你的问题

[Question]: 请问在 ppdiffuser 内,如何加载多个 lora,然后使用 prompt 进行切换?请问有相关的示例代码可以提供下嘛?谢谢

lxp521125 commented 11 months ago

虽然你加载了lora但是真的要生效要prompt里写上lora这个时候才行。在文件ppdiffusers/examples/community/webui_stable_diffusion.py 里有使用说明。 可以根据文件名字来自动加载。 不知道你是不是找这个。 这里的小demo也可以看看https://aistudio.baidu.com/aistudio/projectdetail/6468541?contributionType=1

ViewWholeWorld commented 11 months ago
image

我是在 0.16.1 的 release 里面看到说可以 prompt 动态加载lora,想问问这个是什么意思呀?

lxp521125 commented 11 months ago

指定lora文件夹,然后通过prompt自动识别到要加载的lora,然后从本地加载。实现动态加载。 非官方,仅自己理解。

ViewWholeWorld commented 11 months ago

指定lora文件夹,然后通过prompt自动识别到要加载的lora,然后从本地加载。实现动态加载。 非官方,仅自己理解。

所以想问下官方有没有demo 可以分享一下 ^_^

JunnYu commented 11 months ago

https://github.com/PaddlePaddle/PaddleNLP/tree/develop/ppdiffusers/examples/community#automatic1111-webui-stable-diffusion @ViewWholeWorld 可以参考一下这里的加载方案

ViewWholeWorld commented 11 months ago

https://github.com/PaddlePaddle/PaddleNLP/tree/develop/ppdiffusers/examples/community#automatic1111-webui-stable-diffusion @ViewWholeWorld 可以参考一下这里的加载方案

请问下调用了download_civitai_lora_file这个方法后,是只下载,还是说下载+加载一起啊

JunnYu commented 11 months ago

加载是通过prompt进行控制的,lora文件会存档到一个指定的目录,我们需要通过prompt加载特定的lora文件,可以是单个也可以是多个