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

Paddle-Lite在Docker 统一编译环境搭建失败 #10592

Open
wwma opened this issue Nov 15, 2024 · 6 comments
Open

Paddle-Lite在Docker 统一编译环境搭建失败 #10592

wwma opened this issue Nov 15, 2024 · 6 comments

Comments

@wwma
Copy link

wwma commented Nov 15, 2024

  • 版本、环境信息:
       1)Paddle Lite 版本:v2.14-rc
       2)Host 环境:在windows下使用wsl提供的Linux系统

  • 编译/安装方式信息:
    1)docker 编译:

#本地源码编译 Docker 镜像
git clone https://github.com/PaddlePaddle/Paddle-Lite.git
cd Paddle-Lite/lite/tools
mkdir mobile_image
cp Dockerfile.mobile mobile_image/Dockerfile
cd mobile_image
docker build -t paddlepaddle/paddle-lite .

报错信息:

 => CACHED [14/18] RUN ln -s clang-format-3.8 /usr/bin/clang-format                                                0.0s
 => ERROR [15/18] RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple wheel                                4.4s
------
 > [15/18] RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple wheel:
0.501 Collecting wheel
0.822   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e7/52/fd4516fb8f7d11a08e3f9cd69eb1558f098ab67e79f32d920c4974ee550f/wheel-0.45.0.tar.gz (107kB)
0.967 Building wheels for collected packages: wheel
0.968   Running setup.py bdist_wheel for wheel: started
1.023   Failed building wheel for wheel
1.023   Running setup.py bdist_wheel for wheel: finished with status 'error'
1.023   Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-OkcxG4/wheel/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpFg4GeZpip-wheel- --python-tag cp27:
1.023   /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
1.023     warnings.warn(msg)
1.023   usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
1.023      or: -c --help [cmd1 cmd2 ...]
1.023      or: -c --help-commands
1.023      or: -c cmd --help
1.023
1.023   error: invalid command 'bdist_wheel'
1.023
1.023   ----------------------------------------
1.023   Running setup.py clean for wheel
1.088 Failed to build wheel
1.088 Installing collected packages: wheel
1.089   Running setup.py install for wheel: started
1.150     Running setup.py install for wheel: finished with status 'error'
1.150     Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-OkcxG4/wheel/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-CsubNh-record/install-record.txt --single-version-externally-managed --compile:
1.150     /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
1.150       warnings.warn(msg)
1.150     running install
1.150     running build
1.150     running build_py
1.150     creating build
1.150     creating build/lib.linux-x86_64-2.7
1.150     creating build/lib.linux-x86_64-2.7/wheel
1.150     copying src/wheel/wheelfile.py -> build/lib.linux-x86_64-2.7/wheel
1.150     copying src/wheel/bdist_wheel.py -> build/lib.linux-x86_64-2.7/wheel
1.150     copying src/wheel/__init__.py -> build/lib.linux-x86_64-2.7/wheel
1.150     copying src/wheel/_bdist_wheel.py -> build/lib.linux-x86_64-2.7/wheel
1.150     copying src/wheel/metadata.py -> build/lib.linux-x86_64-2.7/wheel
1.150     copying src/wheel/_setuptools_logging.py -> build/lib.linux-x86_64-2.7/wheel
1.150     copying src/wheel/__main__.py -> build/lib.linux-x86_64-2.7/wheel
1.150     copying src/wheel/macosx_libfile.py -> build/lib.linux-x86_64-2.7/wheel
1.150     copying src/wheel/util.py -> build/lib.linux-x86_64-2.7/wheel
1.150     creating build/lib.linux-x86_64-2.7/wheel/cli
1.150     copying src/wheel/cli/__init__.py -> build/lib.linux-x86_64-2.7/wheel/cli
1.150     copying src/wheel/cli/convert.py -> build/lib.linux-x86_64-2.7/wheel/cli
1.150     copying src/wheel/cli/unpack.py -> build/lib.linux-x86_64-2.7/wheel/cli
1.150     copying src/wheel/cli/tags.py -> build/lib.linux-x86_64-2.7/wheel/cli
1.150     copying src/wheel/cli/pack.py -> build/lib.linux-x86_64-2.7/wheel/cli
1.150     creating build/lib.linux-x86_64-2.7/wheel/vendored
1.150     copying src/wheel/vendored/__init__.py -> build/lib.linux-x86_64-2.7/wheel/vendored
1.150     creating build/lib.linux-x86_64-2.7/wheel/vendored/packaging
1.150     copying src/wheel/vendored/packaging/_manylinux.py -> build/lib.linux-x86_64-2.7/wheel/vendored/packaging
1.150     copying src/wheel/vendored/packaging/utils.py -> build/lib.linux-x86_64-2.7/wheel/vendored/packaging
1.150     copying src/wheel/vendored/packaging/__init__.py -> build/lib.linux-x86_64-2.7/wheel/vendored/packaging
1.150     copying src/wheel/vendored/packaging/_musllinux.py -> build/lib.linux-x86_64-2.7/wheel/vendored/packaging
1.150     copying src/wheel/vendored/packaging/requirements.py -> build/lib.linux-x86_64-2.7/wheel/vendored/packaging
1.150     copying src/wheel/vendored/packaging/markers.py -> build/lib.linux-x86_64-2.7/wheel/vendored/packaging
1.150     copying src/wheel/vendored/packaging/_parser.py -> build/lib.linux-x86_64-2.7/wheel/vendored/packaging
1.150     copying src/wheel/vendored/packaging/_elffile.py -> build/lib.linux-x86_64-2.7/wheel/vendored/packaging
1.150     copying src/wheel/vendored/packaging/_structures.py -> build/lib.linux-x86_64-2.7/wheel/vendored/packaging
1.150     copying src/wheel/vendored/packaging/tags.py -> build/lib.linux-x86_64-2.7/wheel/vendored/packaging
1.150     copying src/wheel/vendored/packaging/_tokenizer.py -> build/lib.linux-x86_64-2.7/wheel/vendored/packaging
1.150     copying src/wheel/vendored/packaging/version.py -> build/lib.linux-x86_64-2.7/wheel/vendored/packaging
1.150     copying src/wheel/vendored/packaging/specifiers.py -> build/lib.linux-x86_64-2.7/wheel/vendored/packaging
1.150     error: can't copy 'src/wheel/vendored': doesn't exist or not a regular file
1.150
1.150     ----------------------------------------
1.153 Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-OkcxG4/wheel/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-CsubNh-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-OkcxG4/wheel/
4.380 You are using pip version 8.1.1, however version 24.3.1 is available.
4.380 You should consider upgrading via the 'pip install --upgrade pip' command.
------

 3 warnings found (use docker --debug to expand):
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 61)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 62)
 - MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label (line 4)
Dockerfile:71
--------------------
  69 |     # clean
  70 |     RUN ln -s clang-format-3.8 /usr/bin/clang-format
  71 | >>> RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple wheel
  72 |     RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pre-commit
  73 |     RUN apt-get autoremove -y && apt-get clean
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install -i https://pypi.tuna.tsinghua.edu.cn/simple wheel" did not complete successfully: exit code: 1
@SongMingzhe
Copy link
Collaborator

paddle-lite有image可以用的,可以试试这个哦:

docker pull paddlepaddle/paddle-lite:latest

https://hub.docker.com/r/paddlepaddle/paddle-lite

@wwma
Copy link
Author

wwma commented Nov 15, 2024

paddle-lite有image可以用的,可以试试这个哦:

docker pull paddlepaddle/paddle-lite:latest

https://hub.docker.com/r/paddlepaddle/paddle-lite

谢谢,我已经成功安装好镜像了。
但是我按照以下代码启动docker

docker run -it \
  --name paddlelite_docker \
  -v $PWD/Paddle-Lite:/Paddle-Lite \
  --net=host \
  paddlepaddle/paddle-lite /bin/bash

无法进行预测

paddle_lite_opt --model_dir=./mobilenet_v1  \
                --optimize_out=mobilenet_v1_opt \
                --optimize_out_type=naive_buffer \
                --valid_targets=x86

会提示错误信息:

root@docker-desktop:/# paddle_lite_opt 
bash: paddle_lite_opt: command not found

@SongMingzhe
Copy link
Collaborator

paddlepaddle/paddle-lite:latest 这个镜像是一个编译环境,我们用它来编译各种库文件和工具。

paddle_lite_opt 这是一个python命令行工具,用来把paddlepaddle训练出来的模型优化成端侧推理需要用的模型文件
安装使用方法 https://www.paddlepaddle.org.cn/lite/v2.12/user_guides/opt/opt_python.html。
这个命令行工具不是必须在paddlepaddle/paddle-lite:latest镜像中使用,一般python环境都能用。

此外,还有一个命令行工具可以用来把paddlepaddle训练出来的模型优化成端侧推理需要用的模型文件:
https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.12/opt_linux
这个不是python命令行。根据你的操作系统不同,可以下载Linux/macOS

@wwma
Copy link
Author

wwma commented Nov 18, 2024

paddlepaddle/paddle-lite:latest 这个镜像是一个编译环境,我们用它来编译各种库文件和工具。

paddle_lite_opt 这是一个python命令行工具,用来把paddlepaddle训练出来的模型优化成端侧推理需要用的模型文件 安装使用方法 https://www.paddlepaddle.org.cn/lite/v2.12/user_guides/opt/opt_python.html。 这个命令行工具不是必须在paddlepaddle/paddle-lite:latest镜像中使用,一般python环境都能用。

此外,还有一个命令行工具可以用来把paddlepaddle训练出来的模型优化成端侧推理需要用的模型文件: https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.12/opt_linux 这个不是python命令行。根据你的操作系统不同,可以下载Linux/macOS

通过pip install paddlelite ,成功安装了2.13版本,但是在使用以下语句时,会提示错误:
Segmentation fault (core dumped)
以下是log信息
[3 11/18 10:55:33.986 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.989 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.990 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.991 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.994 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.994 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.995 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.998 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.999 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33. 9 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33. 10 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [1 11/18 10:55:34. 15 .../Paddle-Lite/lite/operators/concat_op.cc:53 InferShapeImpl] out_dims[j] == input_dims_i[j] check failed! [1 11/18 10:55:34. 15 .../Paddle-Lite/lite/operators/concat_op.cc:53 InferShapeImpl] 7 != 17
请问是哪里有问题?

@SongMingzhe
Copy link
Collaborator

paddlepaddle/paddle-lite:latest 这个镜像是一个编译环境,我们用它来编译各种库文件和工具。
paddle_lite_opt 这是一个python命令行工具,用来把paddlepaddle训练出来的模型优化成端侧推理需要用的模型文件 安装使用方法 https://www.paddlepaddle.org.cn/lite/v2.12/user_guides/opt/opt_python.html。 这个命令行工具不是必须在paddlepaddle/paddle-lite:latest镜像中使用,一般python环境都能用。
此外,还有一个命令行工具可以用来把paddlepaddle训练出来的模型优化成端侧推理需要用的模型文件: https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.12/opt_linux 这个不是python命令行。根据你的操作系统不同,可以下载Linux/macOS

通过pip install paddlelite ,成功安装了2.13版本,但是在使用以下语句时,会提示错误: Segmentation fault (core dumped) 以下是log信息 [3 11/18 10:55:33.986 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.989 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.990 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.991 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.994 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.994 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.995 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.998 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.999 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33. 9 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33. 10 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [1 11/18 10:55:34. 15 .../Paddle-Lite/lite/operators/concat_op.cc:53 InferShapeImpl] out_dims[j] == input_dims_i[j] check failed! [1 11/18 10:55:34. 15 .../Paddle-Lite/lite/operators/concat_op.cc:53 InferShapeImpl] 7 != 17 请问是哪里有问题?

这里你执行的命令是什么样的呢?

@wwma
Copy link
Author

wwma commented Nov 18, 2024

paddlepaddle/paddle-lite:latest 这个镜像是一个编译环境,我们用它来编译各种库文件和工具。
paddle_lite_opt 这是一个python命令行工具,用来把paddlepaddle训练出来的模型优化成端侧推理需要用的模型文件 安装使用方法 https://www.paddlepaddle.org.cn/lite/v2.12/user_guides/opt/opt_python.html。 这个命令行工具不是必须在paddlepaddle/paddle-lite:latest镜像中使用,一般python环境都能用。
此外,还有一个命令行工具可以用来把paddlepaddle训练出来的模型优化成端侧推理需要用的模型文件: https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.12/opt_linux 这个不是python命令行。根据你的操作系统不同,可以下载Linux/macOS

通过pip install paddlelite ,成功安装了2.13版本,但是在使用以下语句时,会提示错误: Segmentation fault (core dumped) 以下是log信息 [3 11/18 10:55:33.986 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.989 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.990 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.991 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.994 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.994 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.995 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.998 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33.999 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33. 9 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [3 11/18 10:55:33. 10 ...le-Lite/lite/kernels/x86/conv_compute.cc:119 PrepareForRun] invoking directConv [1 11/18 10:55:34. 15 .../Paddle-Lite/lite/operators/concat_op.cc:53 InferShapeImpl] out_dims[j] == input_dims_i[j] check failed! [1 11/18 10:55:34. 15 .../Paddle-Lite/lite/operators/concat_op.cc:53 InferShapeImpl] 7 != 17 请问是哪里有问题?

这里你执行的命令是什么样的呢?

执行的命令是这个:
python lite/demo/python/mobilenetv1_light_api.py --model_dir=pplite_opt.nb --image_path=pic.jpg

后面通过更改图片的大小,不会再有报错信息了。但是结果全是0,和未转换的模型结果不一致,请问应该怎么解决?
image

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

No branches or pull requests

2 participants