Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Hackathon 5th】fastdeploy版的sd15模型添加gradio界面 #311

Merged
merged 13 commits into from
Dec 27, 2023

Conversation

sanbuphy
Copy link
Contributor

@sanbuphy sanbuphy commented Nov 18, 2023

支持文生图、图生图、inpaint_legacy、inpaint、controlnet+canny的推理
#256

aistudio 项目还在施工中。

@JunnYu JunnYu self-requested a review November 20, 2023 02:49
ppdiffusers/deploy/gradio_demo.py Outdated Show resolved Hide resolved
ppdiffusers/deploy/gradio_demo.py Outdated Show resolved Hide resolved
@sanbuphy sanbuphy requested a review from JunnYu November 24, 2023 03:39
@JunnYu
Copy link
Member

JunnYu commented Nov 24, 2023

你好,需要添加更多的参数到gradio界面,比如negative_prompt,guidance scale

@sanbuphy
Copy link
Contributor Author

你好,需要添加更多的参数到gradio界面,比如negative_prompt,guidance scale

需要全部吗?因为 pipe那边还满多的,还是说常见的即可呢

@JunnYu
Copy link
Member

JunnYu commented Nov 24, 2023

  • 需要一些常见的这种参数。
  • 当前我测试了一下,有个可以跑通推理的paddle和fd及ppdiffusers环境,之后我提供一下版本,你可以继续这部分开发了
  • 我看了一下inpaint的界面,可能需要自动涂抹mask的工具,无需手动上传

@sanbuphy
Copy link
Contributor Author

  • 需要一些常见的这种参数。
  • 当前我测试了一下,有个可以跑通推理的paddle和fd及ppdiffusers环境,之后我提供一下版本,你可以继续这部分开发了
  • 我看了一下inpaint的界面,可能需要自动涂抹mask的工具,无需手动上传

1.2 : 收到
3 :我看看gradio 的组件是否支持这种形式

@JunnYu
Copy link
Member

JunnYu commented Nov 28, 2023

如果想要导出模型,请使用ppdiffusers==0.16.3进行导出。

推理的环境:

# aistudio的v100环境下
python -m pip install paddlepaddle-gpu==2.5.2 -i https://pypi.tuna.tsinghua.edu.cn/simple --user
pip install fastdeploy-gpu-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html --user
pip install https://paddlenlp.bj.bcebos.com/models/community/junnyu/fd_trt_model/ppdiffusers-0.19.3-py3-none-any.whl --user

适配文生图,图生图,inpaint legacy的模型

# 下载导出后的模型
# 这个是适配文生图,图生图,inpaint legacy的模型
wget https://paddlenlp.bj.bcebos.com/models/community/junnyu/fd_trt_model/runwayml_stable-diffusion-v1-5_fd.tar.gz && tar -zxvf runwayml_stable-diffusion-v1-5_fd.tar.gz

python infer.py --model_dir runwayml_stable-diffusion-v1-5_fd --task_name text2img
python infer.py --model_dir runwayml_stable-diffusion-v1-5_fd --task_name img2img
python infer.py --model_dir runwayml_stable-diffusion-v1-5_fd --task_name inpaint_legacy
image

适配inpaint的模型

wget https://paddlenlp.bj.bcebos.com/models/community/junnyu/fd_trt_model/stable-diffusion-v1-5-inpainting.tar.gz && tar -zxvf stable-diffusion-v1-5-inpainting.tar.gz
python infer.py --model_dir stable-diffusion-v1-5-inpainting --task_name inpaint
image

适配Controlnet的模型

# 使用的是controlnet目录下的infer
cd controlnet
# 下载
wget https://paddlenlp.bj.bcebos.com/models/community/junnyu/fd_trt_model/control_sd15_canny.tar.gz && tar -zxvf control_sd15_canny.tar.gz
python infer.py --model_dir control_sd15_canny --task_name text2img_control
image

@sanbuphy
Copy link
Contributor Author

sanbuphy commented Dec 2, 2023

@JunnYu 验证如下:(目前是普通的后端跑通但留了fd的接口)

普通pipe

image
image
image

inpaint

image

canny

image

@JunnYu
Copy link
Member

JunnYu commented Dec 7, 2023

现在咋样了呢?这个gradio界面能跑成功了吗?

@sanbuphy
Copy link
Contributor Author

sanbuphy commented Dec 7, 2023

现在咋样了呢?这个gradio界面能跑成功了吗?

sorry这两三天加班都到九点多,我已经把模型拉到本地了,明晚上看看能不能再给新的一版

@sanbuphy sanbuphy requested a review from JunnYu December 9, 2023 09:33
@sanbuphy
Copy link
Contributor Author

sanbuphy commented Dec 9, 2023

现在咋样了呢?这个gradio界面能跑成功了吗?

修正了大小 和图生图 inpaint问题:

image

image

@sanbuphy
Copy link
Contributor Author

@JunnYu 麻烦研发大哥有空看看~

@shiyutang shiyutang changed the title fastdeploy版的sd15模型添加gradio界面 【Hackathon 5th】fastdeploy版的sd15模型添加gradio界面 Dec 13, 2023
@JunnYu
Copy link
Member

JunnYu commented Dec 19, 2023

我跑了一下,文生图、图生图、inpaint没有问题。
image

@JunnYu
Copy link
Member

JunnYu commented Dec 19, 2023

再添加一下对应的使用的readme,以及使用结果的截图。

@sanbuphy
Copy link
Contributor Author

再添加一下对应的使用的readme,以及使用结果的截图。

图片文件存在哪,可以新建asset文件夹吗

@JunnYu
Copy link
Member

JunnYu commented Dec 21, 2023

@sanbuphy 直接放到github这里,比如拖拽个图片进来
image

JunnYu
JunnYu previously approved these changes Dec 21, 2023
Copy link
Member

@JunnYu JunnYu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sanbuphy
Copy link
Contributor Author

@sanbuphy 直接放到github这里,比如拖拽个图片进来 image

明白,我写下readme

@JunnYu
Copy link
Member

JunnYu commented Dec 22, 2023

TODO内容:

  1. readme完善
  2. aistudio部署gradio项目
    LGTM

@sanbuphy
Copy link
Contributor Author

TODO内容:

  1. readme完善
  2. aistudio部署gradio项目
    LGTM

已部署成功,已添加readme


pip install fastdeploy-gpu-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html

pip install https://paddlenlp.bj.bcebos.com/models/community/junnyu/fd_trt_model/ppdiffusers-0.19.3-py3-none-any.whl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.19.4 不用这个版本了

@JunnYu
Copy link
Member

JunnYu commented Dec 27, 2023

image
image
image

@JunnYu JunnYu self-requested a review December 27, 2023 11:40
Copy link
Member

@JunnYu JunnYu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JunnYu JunnYu merged commit 9769ebe into PaddlePaddle:develop Dec 27, 2023
1 of 3 checks passed
@bigmover
Copy link

bigmover commented Mar 6, 2024

支持文生图、图生图、inpaint_legacy、inpaint、controlnet+canny的推理 #256

aistudio 项目还在施工中。

请问这边的文生图/图生图接口,会和diffusers相关接口保持同步吗?比如StableDiffusionControlNetInpaintPipeline, StableDiffusionControlNetImg2ImgPipeline 这种接口好像diffusers的参数他有时候会增加的

@sanbuphy
Copy link
Contributor Author

sanbuphy commented Mar 9, 2024

支持文生图、图生图、inpaint_legacy、inpaint、controlnet+canny的推理 #256
aistudio 项目还在施工中。

请问这边的文生图/图生图接口,会和diffusers相关接口保持同步吗?比如StableDiffusionControlNetInpaintPipeline, StableDiffusionControlNetImg2ImgPipeline 这种接口好像diffusers的参数他有时候会增加的

你好,比较困难,没有ci覆盖不知道什么时候坏了需要修理,只能固定一个版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants