-
Notifications
You must be signed in to change notification settings - Fork 222
Closed
Labels
HappyOpenSource Pro快乐开源issue与PR,更具挑战的任务快乐开源issue与PR,更具挑战的任务
Description
fastdeploy版的sd15模型添加gradio界面
任务描述
任务背景
- FastDeploy是一款面向全场景、易用且灵活、高效的AI推理部署工具,它支持云端和边缘端的部署,并为开发者提供超过160种文本、视觉、语音和跨模态模型。PPDiffusers中的StableDiffusion模型已经能够与FastDeploy兼容,实现推理操作,然而当前阶段,仍缺少一个可交互的Gradio调用界面,因此需要开发者进行相应的界面添加。
完成步骤
- 熟悉 ppdiffusers部署中的部署流程。
- 编写文生图、图生图、inpaint_legacy、inpaint、controlnet+canny的gradio界面。
- 要求推理后端使用paddle-trt。
- 在aistudio平台上搭建Gradio项目,参考Gradio应用介绍。
- 提交代码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
提交内容:
- 单个gradio.py文件,里面支持文生图、图生图、inpaint_legacy、inpaint、controlnet+canny的推理。
- aistudio上的gradio项目。
Metadata
Metadata
Assignees
Labels
HappyOpenSource Pro快乐开源issue与PR,更具挑战的任务快乐开源issue与PR,更具挑战的任务