PaddlePaddle / FastDeploy

⚡️An Easy-to-use and Fast Deep Learning Model Deployment Toolkit for ☁️Cloud 📱Mobile and 📹Edge. Including Image, Video, Text and Audio 20+ main stream scenarios and 150+ SOTA models with end-to-end optimization, multi-platform and multi-framework support.
https://www.paddlepaddle.org.cn/fastdeploy
Apache License 2.0
2.93k stars 456 forks source link

运行stable-diffusion 的c++ 示例报错 #2380

Open ChaoII opened 7 months ago

ChaoII commented 7 months ago

编译信息:

-- *************FastDeploy Building Summary**********
--   CMake version             : 3.26.4
--   CMake command             : C:/software/CLion 2022.3.2/bin/cmake/win/x64/bin/cmake.exe
--   System                    : Windows
--   C++ compiler              : C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/cl.exe
--   C++ standard              : 
--   C++ cuda standard         : 
--   C++ compiler version      : 19.35.32215.0
--   CXX flags                 : /DWIN32 /D_WINDOWS /W3 /GR /EHsc
--   EXE linker flags          : /machine:x64
--   Shared linker flags       : /machine:x64
--   Build type                : Release
--   Compile definitions       : 
--   CMAKE_PREFIX_PATH         : 
--   CMAKE_INSTALL_PREFIX      : C:/Program Files (x86)/main
--   CMAKE_MODULE_PATH         : 
-- 
--   FastDeploy version        : 0.0.0
--   ENABLE_ORT_BACKEND        : OM
--   ENABLE_RKNPU2_BACKEND     : OFF
--   ENABLE_HORIZON_BACKEND    : OFF
--   ENABLE_SOPHGO_BACKEND     : OFF
--   ENABLE_PADDLE_BACKEND     : ON
--   ENABLE_LITE_BACKEND       : OFF
--   ENABLE_POROS_BACKEND      : OFF
--   ENABLE_TRT_BACKEND        : ON
--   ENABLE_OPENVINO_BACKEND   : OFF
--   ENABLE_TVM_BACKEND        : OFF
--   ENABLE_BENCHMARK          : OFF
--   ENABLE_VISION             : ON
--   ENABLE_TEXT               : ON
--   ENABLE_ENCRYPTION         : OFF
--   ENABLE_FLYCV              : OFF
--   ENABLE_CVCUDA             : OFF
--   WITH_GPU                  : ON
--   WITH_IPU                  : OFF
--   WITH_OPENCL               : OFF
--   WITH_TESTING              : OFF
--   WITH_ASCEND               : OFF
--   WITH_DIRECTML             : OFF
--   WITH_TIMVX                : OFF
--   WITH_KUNLUNXIN            : OFF
--   WITH_CAPI                 : OFF
--   WITH_CSHARPAPI            : OFF
--   ONNXRuntime version       : 
--   Paddle Inference version  : 2.5.0.281761089e
--   PADDLE_WITH_ENCRYPT       : OFF
--   PADDLE_WITH_AUTH          : OFF
--   CUDA_DIRECTORY            : C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7
--   TRT_DRECTORY              : 
--   DEPENDENCY_LIBS           : E:/FastDeploy/build_gpu/install/lib/fastdeploy.lib;E:/FastDeploy/build_gpu/install/third_libs/install/onnxruntime/lib/onnxruntime.lib;E:/FastDeploy/build_gpu/install/third_libs/install/paddle_inference/paddle/lib/paddle_inference.lib;E:/FastDeploy/build_gpu/install/third_libs/install/paddle_inference/third_party/install/mkldnn/lib/mkldnn.lib;E:/FastDeploy/build_gpu/install/third_libs/install/paddle_inference/third_party/install/mklml/lib/libiomp5md.lib;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/lib/x64/cudart.lib;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/lib/x64/nvjpeg.lib;E:/FastDeploy/build_gpu/install/third_libs/install/tensorrt/lib/nvinfer.lib;E:/FastDeploy/build_gpu/install/third_libs/install/tensorrt/lib/nvonnxparser.lib;E:/FastDeploy/build_gpu/install/third_libs/install/tensorrt/lib/nvinfer_plugin.lib;opencv_calib3d;opencv_core;opencv_features2d;opencv_flann;opencv_gapi;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_photo;opencv_stitching;opencv_video;opencv_videoio;E:/FastDeploy/build_gpu/install/third_libs/install/fast_tokenizer/lib/core_tokenizers.lib;E:/FastDeploy/build_gpu/install/third_libs/install/paddle2onnx/lib/paddle2onnx.lib

报错信息:

[ERROR] fastdeploy/utils/utils.cc(54)::fastdeploy::ReadBinaryFromFile   Failed to open file: ./stable-diffusion-v1-4\vae
_encoder\inference.pdmodel to read.
[ERROR] fastdeploy/runtime/backends/paddle/paddle_backend.cc(209)::fastdeploy::PaddleBackend::InitFromPaddle    Failed t
o read file ./stable-diffusion-v1-4\vae_encoder\inference.pdmodel.
heliqi commented 7 months ago

paddle版本是多少?

ChaoII commented 7 months ago

编译的时候下的库,上面编译信息写的是Paddle Inference version : 2.5.0.281761089e

ChaoII commented 7 months ago

https://github.com/PaddlePaddle/FastDeploy/blob/1314f3267e8e35b467eb75cb815858155ea16c10/examples/multimodal/stable_diffusion/cpp/main.cc#L123 这一行可以加载,到加载vae编码器的时候136行报了上面的错

heliqi commented 7 months ago

你尝试换成2.3版本的paddle inference包重新编译试试。 或者你使用我们预编译好的fd包: https://github.com/PaddlePaddle/FastDeploy/blob/develop/docs/cn/build_and_install/download_prebuilt_libraries.md

ChaoII commented 7 months ago

预编译的sdk无法使用因为stable-diffusion用到了高斯随机数函数,但是函数符号没有被导出,报错信息:

无法解析的外部符号 "void __cdecl fastdeploy::function::GaussianRandom(class std::vector<__int64,class std::allocator<__int64> > const &,struct fastdeploy::FDTensor *,enum fastdeploy::FDDataType,float,float,int)" 

我在pr #2379 给出了修复,还没有合入。

jiangjiajun commented 7 months ago

2379

感谢贡献!