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

fastdeploy版的sd15模型添加gradio界面 #256

Closed
chenjjcccc opened this issue Oct 31, 2023 · 1 comment
Closed

fastdeploy版的sd15模型添加gradio界面 #256

chenjjcccc opened this issue Oct 31, 2023 · 1 comment
Labels
HappyOpenSource Pro 快乐开源issue与PR,更具挑战的任务

Comments

@chenjjcccc
Copy link

chenjjcccc commented Oct 31, 2023

fastdeploy版的sd15模型添加gradio界面

任务描述

任务背景

  • FastDeploy是一款面向全场景、易用且灵活、高效的AI推理部署工具,它支持云端和边缘端的部署,并为开发者提供超过160种文本、视觉、语音和跨模态模型。PPDiffusers中的StableDiffusion模型已经能够与FastDeploy兼容,实现推理操作,然而当前阶段,仍缺少一个可交互的Gradio调用界面,因此需要开发者进行相应的界面添加。

完成步骤

  1. 熟悉 ppdiffusers部署中的部署流程。
  2. 编写文生图、图生图、inpaint_legacy、inpaint、controlnet+canny的gradio界面。
  3. 要求推理后端使用paddle-trt。
  4. 在aistudio平台上搭建Gradio项目,参考Gradio应用介绍
  5. 提交代码PR到 PPDiffusers中deploy目录

建议版本:

  • paddlepaddle 2.5.2
  • fastdeploy-python-gpu 1.0.7
  • ppdiffusers==0.16.3
  • python 3.10

推理时候请确保--scheduler "euler-ancestral" --infer_op raw --backend paddle_tensorrt --use_fp16 True --device gpu

# 1. sd1-5导出模型
# 关闭ppxformers,否则会导致模型导出失败
export USE_PPXFORMERS=False
python export_model.py --pretrained_model_name_or_path runwayml/stable-diffusion-v1-5 --output_path stable-diffusion-v1-5

## 文生图推理
python infer.py --model_dir stable-diffusion-v1-5/ --scheduler "euler-ancestral" --infer_op raw --backend paddle_tensorrt --use_fp16 True --device gpu --task_name text2img

## 图生图推理
python infer.py --model_dir stable-diffusion-v1-5/ --scheduler "euler-ancestral" --infer_op raw --backend paddle_tensorrt --use_fp16 True --device gpu --task_name img2img

## inpaint_legacy
python infer.py --model_dir stable-diffusion-v1-5/ --scheduler euler-ancestral --infer_op raw --backend paddle_tensorrt --use_fp16 True --device gpu --task_name inpaint_legacy
# 2. sd1-5 inpaint 导出模型
# 关闭ppxformers,否则会导致模型导出失败
export USE_PPXFORMERS=False
python export_model.py --pretrained_model_name_or_path runwayml/stable-diffusion-inpainting --output_path stable-diffusion-v1-5-inpainting

## inpaint
python infer.py --model_dir stable-diffusion-v1-5-inpainting/ --scheduler euler-ancestral --infer_op raw --backend paddle_tensorrt --use_fp16 True --device gpu --task_name inpaint
# 3. sd15 controlnet导出
# 关闭ppxformers,否则会导致模型导出失败
export USE_PPXFORMERS=False
python export_model.py --pretrained_model_name_or_path runwayml/stable-diffusion-v1-5 --controlnet_pretrained_model_name_or_path  lllyasviel/sd-controlnet-canny --output_path control_sd15_canny

## controlnet canny
python infer.py --model_dir control_sd15_canny --scheduler "euler-ancestral" --infer_op raw --backend paddle_tensorrt --device gpu --benchmark_steps 10 --use_fp16 True --task text2img_control

提交内容:

  1. 单个gradio.py文件,里面支持文生图、图生图、inpaint_legacy、inpaint、controlnet+canny的推理。
  2. aistudio上的gradio项目。
@sanbuphy
Copy link
Contributor

sanbuphy commented Nov 9, 2023

接了

JunnYu pushed a commit that referenced this issue Dec 27, 2023
支持文生图、图生图、inpaint_legacy、inpaint、controlnet+canny的推理
#256

aistudio 项目还在施工中。
@JunnYu JunnYu closed this as completed Dec 27, 2023
westfish pushed a commit to westfish/PaddleMIX that referenced this issue Sep 25, 2024
支持文生图、图生图、inpaint_legacy、inpaint、controlnet+canny的推理
PaddlePaddle#256

aistudio 项目还在施工中。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HappyOpenSource Pro 快乐开源issue与PR,更具挑战的任务
Projects
None yet
Development

No branches or pull requests

4 participants