MNN icon indicating copy to clipboard operation
MNN copied to clipboard

[WIN-MNN-CONVERTER]:Error in compling mnn converter with torchscript supported.

Open gs-ren opened this issue 2 years ago • 1 comments

平台(如果交叉编译请再附上交叉编译目标平台):

Platform(Include target platform as well if cross-compiling):

Github版本:

Github Version: 2.0.0

直接下载ZIP包请提供下载日期以及压缩包注释里的git版本(可通过7z l zip包路径命令并在输出信息中搜索Comment 获得,形如Comment = bc80b11110cd440aacdabbf59658d630527a7f2b)。 git clone请提供 git commit 第一行的commit id

Provide date (or better yet, git revision from the comment section of the zip. Obtainable using 7z l PATH/TO/ZIP and search for Comment in the output) if downloading source as zip,otherwise provide the first commit id from the output of git commit

编译方式:

Compiling Method

Microsoft Visual Studio/2019/Community x64 Native Tools

请在这里粘贴cmake参数或使用的cmake脚本路径以及完整输出
Paste cmake arguments or path of the build script used here as well as the full log of the cmake proess here or pastebin

编译日志:

Build Log:

in powershell:

PS E:\projects\inference\MNN\MNN-2.0.0\build> cmake -G "Ninja" -DMNN_BUILD_SHARED_LIBS=OFF -DMNN_BUILD_CONVERTER=ON -DCMAKE_BUILD_TYPE=Release -DMNN_WIN_RUNTIME_MT=ON -DMNN_BUILD_TORCH=ON   ..
--
-- 3.19.0.0
-- Use Threadpool, forbid openmp
-- >>>>>>>>>>>>>
-- MNN BUILD INFO:
--      System: Windows
--      Processor: AMD64
--      Version: 2.0.0
--      Metal: OFF
--      OpenCL: OFF
--      OpenGL: OFF
--      Vulkan: OFF
--      ARM82: OFF
--      oneDNN: OFF
--      TensorRT: OFF
--      CoreML: OFF
--      CUDA: OFF
--      OpenMP: OFF
--      BF16: OFF
--      ThreadPool: ON
--      Hidden: TRUE
--      Build Path: E:/projects/inference/MNN/MNN-2.0.0/build
-- WIN_USE_ASM:
-- AMD64: Open SSE
-- MNN_AVX512:ON
-- Onnx:
-- LibTorch Path is : E:/projects/inference/libtorch/share/cmake
-- Found Torch: E:/projects/inference/libtorch/lib/torch.lib
CMake Error at tools/converter/source/torch/CMakeLists.txt:37 (add_custom_command):
  Target "MNNConverterTorch" is an OBJECT library that may not have
  PRE_BUILD, PRE_LINK, or POST_BUILD commands.
Call Stack (most recent call first):
  tools/converter/CMakeLists.txt:36 (include)


-- Configuring incomplete, errors occurred!
See also "E:/projects/inference/MNN/MNN-2.0.0/build/CMakeFiles/CMakeOutput.log".
See also "E:/projects/inference/MNN/MNN-2.0.0/build/CMakeFiles/CMakeError.log".

in conda env:

(base) E:\projects\inference\MNN\MNN-2.0.0\build>cmake -G "Ninja" -DMNN_BUILD_SHARED_LIBS=OFF -DMNN_BUILD_CONVERTER=ON -DCMAKE_BUILD_TYPE=Release -DMNN_WIN_RUNTIME_MT=ON ..
--
-- 3.19.0.0
-- Use Threadpool, forbid openmp
-- >>>>>>>>>>>>>
-- MNN BUILD INFO:
--      System: Windows
--      Processor: AMD64
--      Version: 2.0.0
--      Metal: OFF
--      OpenCL: OFF
--      OpenGL: OFF
--      Vulkan: OFF
--      ARM82: OFF
--      oneDNN: OFF
--      TensorRT: OFF
--      CoreML: OFF
--      CUDA: OFF
--      OpenMP: OFF
--      BF16: OFF
--      ThreadPool: ON
--      Hidden: TRUE
--      Build Path: E:/projects/inference/MNN/MNN-2.0.0/build
-- WIN_USE_ASM:
-- AMD64: Open SSE
-- MNN_AVX512:ON
-- Onnx:
-- LibTorch Path is : D:\Miniconda3\lib\site-packages\torch\share\cmake
CMake Error at tools/converter/source/torch/CMakeLists.txt:37 (add_custom_command):
  Target "MNNConverterTorch" is an OBJECT library that may not have
  PRE_BUILD, PRE_LINK, or POST_BUILD commands.
Call Stack (most recent call first):
  tools/converter/CMakeLists.txt:36 (include)


-- Configuring incomplete, errors occurred!
See also "E:/projects/inference/MNN/MNN-2.0.0/build/CMakeFiles/CMakeOutput.log".
See also "E:/projects/inference/MNN/MNN-2.0.0/build/CMakeFiles/CMakeError.log".

use script:

PS E:\projects\inference\MNN\MNN-2.0.0> .\package_scripts\win\build_tools.ps1 -path MNN-CPU/tools/x64


    目录: E:\projects\inference\MNN\MNN-2.0.0\MNN-CPU\tools


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         2022/7/27     17:54                x64
*** cleaning up ***
*** generating fbs under default ***
*** done ***


    目录: E:\projects\inference\MNN\MNN-2.0.0


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         2022/7/27     17:54                build
-- The C compiler identification is MSVC 19.29.30145.0
-- The CXX compiler identification is MSVC 19.29.30145.0
-- The ASM compiler identification is MSVC
-- Found assembler: D:/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: D:/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: D:/Miniconda3/python.exe (found version "3.7.10")
-- Use Threadpool, forbid openmp
-- >>>>>>>>>>>>>
-- MNN BUILD INFO:
--      System: Windows
--      Processor: AMD64
--      Version: 2.0.0
--      Metal: OFF
--      OpenCL: OFF
--      OpenGL: OFF
--      Vulkan: OFF
--      ARM82: OFF
--      oneDNN: OFF
--      TensorRT: OFF
--      CoreML: OFF
--      CUDA: OFF
--      OpenMP: OFF
--      BF16:
--      ThreadPool: ON
--      Hidden: TRUE
--      Build Path: E:/projects/inference/MNN/MNN-2.0.0/build
-- WIN_USE_ASM:
-- AMD64: Open SSE
-- MNN_AVX512:ON
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: E:/projects/inference/MNN/MNN-2.0.0/build
[80/278] Building CXX object CMakeFiles\MNNTransform.dir\source\geometry\GeometryTopK.cpp.obj
E:\projects\inference\MNN\MNN-2.0.0\source\geometry\GeometryTopK.cpp(19): warning C4477: “printf”: 格式字符串“%lu”需要类型“unsigned long”的参数,但可变参数 1 拥有了类型“unsigned __int64”
E:\projects\inference\MNN\MNN-2.0.0\source\geometry\GeometryTopK.cpp(19): note: 请考虑在格式字符串中使用“%zu”
E:\projects\inference\MNN\MNN-2.0.0\source\geometry\GeometryTopK.cpp(19): warning C4477: “printf”: 格式字符串“%lu”需要类型“unsigned long”的参数,但可变参数 2 拥有了类型“unsigned __int64”
E:\projects\inference\MNN\MNN-2.0.0\source\geometry\GeometryTopK.cpp(19): note: 请考虑在格式字符串中使用“%zu”
[104/278] Building CXX object CMakeFiles\MNNTransform.dir\source\shape\ShapePool.cpp.obj
E:\projects\inference\MNN\MNN-2.0.0\3rd_party\flatbuffers\include\flatbuffers\flatbuffers.h(2241) : warning C4723: 潜在的被 0 除
[278/278] Linking CXX static library MNN.lib
E:\projects\inference\MNN\MNN-2.0.0\package_scripts\win\build_tools.ps1 : 不能对 Null 值表达式调用方法。
所在位置 行:1 字符: 1
+ .\package_scripts\win\build_tools.ps1 -path MNN-CPU/tools/x64
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [build_tools.ps1],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull,build_tools.ps1

gs-ren avatar Jul 27 '22 09:07 gs-ren

请问可以提供converter的release预编译包么@jxt1234

gs-ren avatar Jul 27 '22 09:07 gs-ren

Windows下目前不支持TorchScript

wangzhaode avatar Feb 15 '23 12:02 wangzhaode