This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
# PaddleOCR Multi-Devices Usage Guide
|
||||
|
||||
This document focuses on the usage guide of PaddleX for Huawei Ascend NPU and Kunlun XPU hardware platforms.
|
||||
|
||||
## 1、Installation
|
||||
|
||||
### 1.1 PaddlePaddle Installation
|
||||
|
||||
First, please complete the installation of PaddlePaddle according to your hardware platform. The installation tutorials for each hardware are as follows:
|
||||
|
||||
Ascend NPU: [Ascend NPU PaddlePaddle Installation Guide](./paddlepaddle_install_NPU.en.md)
|
||||
|
||||
Kunlun XPU: [Kunlun XPU PaddlePaddle Installation Guide](./paddlepaddle_install_XPU.en.md)
|
||||
|
||||
### 1.2 PaddleOCR Installation
|
||||
|
||||
Please refer to [PaddleOCR Installation Guide](../installation.en.md) to install PaddleOCR。
|
||||
|
||||
## 2、Usage
|
||||
|
||||
The methods for training and inference of PaddleOCR on hardware platforms such as Ascend NPU and Kunlun XPU are the same as those on GPU. You only need to modify the configuration parameters according to the specific hardware platform.
|
||||
On these two hardware platforms, quick inference and model fine-tuning are supported for the three major features of PaddleOCR, including the text recognition model PP-OCRv5, the document parsing solution PP-StructureV3, and PP-ChatOCRv4.
|
||||
|
||||
### 2.1 Quick Inference
|
||||
|
||||
You can quickly experience the OCR pipeline inference with a single command:
|
||||
|
||||
* OCR pipeline inference
|
||||
|
||||
```bash
|
||||
# The default model used is PP-OCRv5
|
||||
paddleocr ocr -i https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device npu:0
|
||||
```
|
||||
|
||||
* PP-StructureV3 pipeline inference
|
||||
|
||||
```bash
|
||||
paddleocr pp_structurev3 -i https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/pp_structure_v3_demo.png --device npu:0
|
||||
```
|
||||
|
||||
To perform quick inference using the production line in your project, you can achieve this with just a few lines of code. Here’s an example of how you might set it up:
|
||||
|
||||
* OCR pipeline inference
|
||||
|
||||
```python
|
||||
from paddleocr import PaddleOCR
|
||||
|
||||
ocr = PaddleOCR(device="npu:0")
|
||||
|
||||
result = ocr.predict("./general_ocr_002.png")
|
||||
for res in result:
|
||||
res.print()
|
||||
res.save_to_img("output")
|
||||
res.save_to_json("output")
|
||||
```
|
||||
|
||||
* PP-StructureV3 pipeline inference
|
||||
|
||||
```python
|
||||
from paddleocr import PPStructureV3
|
||||
|
||||
pipeline = PPStructureV3(device="npu:0")
|
||||
output = pipeline.predict("./pp_structure_v3_demo.png")
|
||||
for res in output:
|
||||
res.print()
|
||||
res.save_to_json(save_path="output")
|
||||
res.save_to_markdown(save_path="output")
|
||||
```
|
||||
|
||||
If you want to know more about OCR pipeline inference,please refer to [general OCR pipeline use guide](../pipeline_usage/OCR.en.md).
|
||||
If you want to know more about PPStructureV3 pipeline inference,please refer to [PP-StructureV3 pipeline use guide](../pipeline_usage/PP-StructureV3.en.md).
|
||||
|
||||
### 2.2 Model Fine-tuning
|
||||
|
||||
If you are not satisfied with the performance of the pre-trained model, you can fine-tune it.
|
||||
|
||||
* train on Ascend NPU
|
||||
```bash
|
||||
export FLAGS_npu_storage_format=0
|
||||
export FLAGS_npu_jit_compile=0
|
||||
export FLAGS_use_stride_kernel=0
|
||||
export FLAGS_allocator_strategy=auto_growth
|
||||
export FLAGS_npu_split_aclnn=True
|
||||
export FLAGS_npu_scale_aclnn=True
|
||||
export CUSTOM_DEVICE_BLACK_LIST=pad3d,pad3d_grad
|
||||
python3 -m paddle.distributed.launch --devices '0,1,2,3' \
|
||||
tools/train.py -c configs/rec/PP-OCRv5/PP-OCRv5_mobile_rec.yml \
|
||||
-o Global.use_gpu=False Global.use_npu=True
|
||||
```
|
||||
|
||||
* train on Kunlun XPU
|
||||
```bash
|
||||
export FLAGS_use_stride_kernel=0
|
||||
export BKCL_FORCE_SYNC=1
|
||||
export BKCL_TIMEOUT=1800
|
||||
export XPU_BLACK_LIST=pad3d,pad3d_grad
|
||||
python3 -m paddle.distributed.launch --devices '0,1,2,3' \
|
||||
tools/train.py -c configs/rec/PP-OCRv5/PP-OCRv5_mobile_rec.yml \
|
||||
-o Global.use_gpu=False Global.use_xpu=True
|
||||
```
|
||||
|
||||
### 2.3 Other Inference methods
|
||||
|
||||
On the Ascend NPU, for a small number of inference samples, using the aforementioned pipeline inference method may result in abnormal outcomes (primarily with the PP-StructureV3 pipeline). To address this issue, we support using ONNX models for inference to ensure correct results.
|
||||
|
||||
You can use the following command to convert a Paddle model to an ONNX model:
|
||||
|
||||
```bash
|
||||
paddlex --install paddle2onnx
|
||||
paddlex --paddle2onnx --paddle_model_dir /paddle_model_dir --onnx_model_dir /onnx_model_dir --opset_version 7
|
||||
```
|
||||
|
||||
Meanwhile, some models support Ascend offline OM inference, effectively optimizing inference performance and memory usage. Using models in OM + ONNX format for pipeline inference can ensure both accuracy and speed.
|
||||
|
||||
Use the ATC conversion tool to convert an ONNX model to an OM model:
|
||||
|
||||
```bash
|
||||
atc --model=inference.onnx --framework=5 --output=inference --soc_version="your_device_type" --input_shape "your_input_shape"
|
||||
```
|
||||
|
||||
We have deeply integrated ONNX and OM models into PaddleX for high-performance inference. By modifying the pipeline configuration file to set the model inference backend to ONNX or OM, you can use the PaddleX high-performance inference API for inference.
|
||||
|
||||
For specific modification methods, inference code, and more usage instructions, please refer to [Ascend NPU High-Performance Inference Tutorial](https://github.com/PaddlePaddle/PaddleX/blob/develop/docs/practical_tutorials/high_performance_npu_tutorial.en.md)。
|
||||
|
||||
## 3、 FAQ
|
||||
### 1.The inference results using PP-StructureV3 on the production line are incorrect.
|
||||
Some models on this line have precision errors in a small number of cases. You can try adjusting the model in the configuration file or use ONNX+OM models for inference.
|
||||
128
docs/version3.x/other_devices_support/multi_devices_use_guide.md
Normal file
128
docs/version3.x/other_devices_support/multi_devices_use_guide.md
Normal file
@@ -0,0 +1,128 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
# PaddleOCR多硬件使用指南
|
||||
|
||||
本文档主要针对昇腾 NPU、昆仑 XPU 等硬件平台,介绍 PaddleOCR 使用指南。
|
||||
|
||||
## 1、安装
|
||||
|
||||
### 1.1 PaddlePaddle安装
|
||||
|
||||
首先请您根据所属硬件平台,完成飞桨 PaddlePaddle 的安装,各硬件的飞桨安装教程如下:
|
||||
|
||||
昇腾 NPU:[昇腾 NPU 飞桨安装教程](./paddlepaddle_install_NPU.md)
|
||||
|
||||
昆仑 XPU:[昆仑 XPU 飞桨安装教程](./paddlepaddle_install_XPU.md)
|
||||
|
||||
### 1.2 PaddleOCR安装
|
||||
|
||||
请参考[PaddleOCR安装教程](../installation.md)安装 PaddleOCR。
|
||||
|
||||
## 2、使用
|
||||
|
||||
基于昇腾 NPU、昆仑 XPU 等硬件平台的 PaddleOCR 训练、推理使用方法与 GPU 相同,只需根据所属硬件平台,修改配置设备的参数。在这两款硬件上,支持 PaddleOCR 三大特色能力的快速推理和模型微调,包括 文字识别模型 PP-OCRv5、文档解析方案 PP-StructureV3 和 PP-ChatOCRv4。
|
||||
|
||||
### 2.1 快速推理
|
||||
|
||||
使用一行命令即可快速体验:
|
||||
|
||||
* OCR 产线推理
|
||||
|
||||
```bash
|
||||
# 默认使用 PP-OCRv5 模型
|
||||
paddleocr ocr -i https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device npu:0 # 将设备名修改为 npu或xpu
|
||||
```
|
||||
|
||||
* PP-StructureV3 产线推理
|
||||
|
||||
```bash
|
||||
paddleocr pp_structurev3 -i https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/pp_structure_v3_demo.png --device npu:0
|
||||
```
|
||||
|
||||
在项目中,您可以通过几行代码即可完成产线的快速推理,推理代码如下:
|
||||
|
||||
* OCR 产线推理
|
||||
```python
|
||||
from paddleocr import PaddleOCR
|
||||
|
||||
ocr = PaddleOCR(device="npu:0")
|
||||
|
||||
result = ocr.predict("./general_ocr_002.png")
|
||||
for res in result:
|
||||
res.print()
|
||||
res.save_to_img("output")
|
||||
res.save_to_json("output")
|
||||
```
|
||||
|
||||
* PP-StructureV3 产线推理
|
||||
```python
|
||||
from paddleocr import PPStructureV3
|
||||
|
||||
pipeline = PPStructureV3(device="npu:0")
|
||||
output = pipeline.predict("./pp_structure_v3_demo.png")
|
||||
for res in output:
|
||||
res.print() ## 打印预测的结构化输出
|
||||
res.save_to_json(save_path="output") ## 保存当前图像的结构化json结果
|
||||
res.save_to_markdown(save_path="output") ## 保存当前图像的markdown格式的结果
|
||||
```
|
||||
|
||||
更多关于 OCR 产线推理的使用说明,请参考[通用OCR产线使用教程](../pipeline_usage/OCR.md)。
|
||||
更多关于 PP-StructureV3 产线推理的使用说明,请参考[PP-StructureV3产线使用教程](../pipeline_usage/PP-StructureV3.md)。
|
||||
|
||||
### 2.2 模型微调
|
||||
|
||||
如果对预训练模型的效果不满意,可以对产线上的模型进行模型微调,示例如下:
|
||||
|
||||
* 昇腾 NPU
|
||||
```bash
|
||||
export FLAGS_npu_storage_format=0
|
||||
export FLAGS_npu_jit_compile=0
|
||||
export FLAGS_use_stride_kernel=0
|
||||
export FLAGS_allocator_strategy=auto_growth
|
||||
export FLAGS_npu_split_aclnn=True
|
||||
export FLAGS_npu_scale_aclnn=True
|
||||
export CUSTOM_DEVICE_BLACK_LIST=pad3d,pad3d_grad
|
||||
python3 -m paddle.distributed.launch --devices '0,1,2,3' \
|
||||
tools/train.py -c configs/rec/PP-OCRv5/PP-OCRv5_mobile_rec.yml \
|
||||
-o Global.use_gpu=False Global.use_npu=True
|
||||
```
|
||||
|
||||
* 昆仑 XPU
|
||||
```bash
|
||||
export FLAGS_use_stride_kernel=0
|
||||
export BKCL_FORCE_SYNC=1
|
||||
export BKCL_TIMEOUT=1800
|
||||
export XPU_BLACK_LIST=pad3d,pad3d_grad
|
||||
python3 -m paddle.distributed.launch --devices '0,1,2,3' \
|
||||
tools/train.py -c configs/rec/PP-OCRv5/PP-OCRv5_mobile_rec.yml \
|
||||
-o Global.use_gpu=False Global.use_xpu=True
|
||||
```
|
||||
|
||||
### 2.3 其它方式推理
|
||||
|
||||
在昇腾 NPU 上,对于少量推理样本,使用上述产线推理方式存在结果异常的可能(主要是 PP-StructureV3 产线),针对这种情况,我们支持使用 ONNX 模型进行推理,保证推理结果正确。
|
||||
|
||||
使用如下命令可以将 Paddle 模型转换为 ONNX 模型:
|
||||
|
||||
```bash
|
||||
paddlex --install paddle2onnx
|
||||
paddlex --paddle2onnx --paddle_model_dir /paddle_model_dir --onnx_model_dir /onnx_model_dir --opset_version 7
|
||||
```
|
||||
|
||||
同时,部分模型支持昇腾离线 OM 推理,有效优化推理性能和内存占用。使用 OM + ONNX 格式的模型进行产线推理,能够同时保障精度和速度。
|
||||
|
||||
使用 atc 转换工具将 ONNX 模型转换为 OM 模型:
|
||||
|
||||
```bash
|
||||
atc --model=inference.onnx --framework=5 --output=inference --soc_version="your_device_type" --input_shape "your_input_shape"
|
||||
```
|
||||
|
||||
我们已将 ONNX 和 OM 模型深度集成进了 PaddleX 高性能推理,修改产线配置文件,配置模型推理后端为 ONNX 或 OM 即可使用 PaddleX 高性能推理 API 进行推理。
|
||||
|
||||
具体修改方法、推理代码以及更多的使用方法请参考[昇腾 NPU 高性能推理教程](https://github.com/PaddlePaddle/PaddleX/blob/develop/docs/practical_tutorials/high_performance_npu_tutorial.md)。
|
||||
|
||||
## 3、常见问题
|
||||
### 1. 使用 PP-StructureV3 产线推理结果不正确
|
||||
该产线上的部分模型在少量 case 上存在精度误差,可以尝试调整配置文件中的模型,或者使用 ONNX+OM 模型进行推理。
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
# Ascend NPU PaddlePaddle Installation Tutorial
|
||||
|
||||
Currently, PaddleOCR supports the Ascend 910B chip (more models are under support. If you have a related need for other models, please submit an issue to inform us). The Ascend driver version is 23.0.3. Considering the differences in environments, we recommend using the <b>Ascend development image provided by PaddlePaddle</b> to complete the environment preparation.
|
||||
|
||||
## 1. Docker Environment Preparation
|
||||
* Pull the image. This image is only for the development environment and does not contain a pre-compiled PaddlePaddle installation package. The image has CANN-8.0.0, the Ascend operator library, installed by default.
|
||||
```bash
|
||||
# For X86 architecture
|
||||
docker pull ccr-2vdh3abv-pub.cnc.bj.baidubce.com/device/paddle-npu:cann800-ubuntu20-npu-910b-base-x86_64-gcc84
|
||||
# For Aarch64 architecture
|
||||
docker pull ccr-2vdh3abv-pub.cnc.bj.baidubce.com/device/paddle-npu:cann800-ubuntu20-npu-910b-base-aarch64-gcc84
|
||||
```
|
||||
* Start the container with the following command. ASCEND_RT_VISIBLE_DEVICES specifies the visible NPU card numbers.
|
||||
```bash
|
||||
docker run -it --name paddle-npu-dev -v $(pwd):/work \
|
||||
--privileged --network=host --shm-size=128G -w=/work \
|
||||
-v /usr/local/Ascend/driver:/usr/local/Ascend/driver \
|
||||
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
|
||||
-v /usr/local/dcmi:/usr/local/dcmi \
|
||||
-e ASCEND_RT_VISIBLE_DEVICES="0,1,2,3,4,5,6,7" \
|
||||
ccr-2vdh3abv-pub.cnc.bj.baidubce.com/device/paddle-npu:cann800-ubuntu20-npu-910b-base-$(uname -m)-gcc84 /bin/bash
|
||||
```
|
||||
## 2. Install Paddle Package
|
||||
* Download and install the Python wheel installation package
|
||||
```bash
|
||||
# Note: You need to install the CPU version of PaddlePaddle first
|
||||
python -m pip install paddlepaddle==3.0.0.dev20250527 -i https://www.paddlepaddle.org.cn/packages/nightly/cpu
|
||||
python -m pip install paddle-custom-npu==3.0.0.dev20250527 -i https://www.paddlepaddle.org.cn/packages/nightly/npu
|
||||
```
|
||||
* CANN-8.0.0 does not support some versions of numpy and opencv, it is recommended to install the specified versions.
|
||||
```bash
|
||||
python -m pip install numpy==1.26.4
|
||||
python -m pip install opencv-python==3.4.18.65
|
||||
```
|
||||
* Set environment variables on the arm machine (not required for x86 environment)
|
||||
```bash
|
||||
# Solve the error reported by libgomp on the arm machine
|
||||
# "libgomp cannot allocate memory in static TLS block"
|
||||
export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1:$LD_PRELOAD
|
||||
```
|
||||
* After verifying that the installation package is installed, run the following command
|
||||
```bash
|
||||
python -c "import paddle; paddle.utils.run_check()"
|
||||
```
|
||||
The expected output is as follows
|
||||
|
||||
```
|
||||
Running verify PaddlePaddle program ...
|
||||
PaddlePaddle works well on 1 npu.
|
||||
PaddlePaddle works well on 8 npus.
|
||||
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
|
||||
```
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
# 昇腾 NPU 飞桨安装教程
|
||||
|
||||
当前 PaddleOCR 支持昇腾 910B 芯片(更多型号还在支持中,如果您有其他型号的相关需求,请提交issue告知我们),昇腾驱动版本为 23.0.3。考虑到环境差异性,我们推荐使用<b>飞桨官方提供的昇腾开发镜像</b>完成环境准备。
|
||||
|
||||
## 1、docker环境准备
|
||||
* 拉取镜像,此镜像仅为开发环境,镜像中不包含预编译的飞桨安装包,镜像中已经默认安装了昇腾算子库 CANN-8.0.0。
|
||||
```bash
|
||||
# 适用于 X86 架构
|
||||
docker pull ccr-2vdh3abv-pub.cnc.bj.baidubce.com/device/paddle-npu:cann800-ubuntu20-npu-910b-base-x86_64-gcc84
|
||||
# 适用于 Aarch64 架构
|
||||
docker pull ccr-2vdh3abv-pub.cnc.bj.baidubce.com/device/paddle-npu:cann800-ubuntu20-npu-910b-base-aarch64-gcc84
|
||||
```
|
||||
* 参考如下命令启动容器,ASCEND_RT_VISIBLE_DEVICES 指定可见的 NPU 卡号
|
||||
```bash
|
||||
docker run -it --name paddle-npu-dev -v $(pwd):/work \
|
||||
--privileged --network=host --shm-size=128G -w=/work \
|
||||
-v /usr/local/Ascend/driver:/usr/local/Ascend/driver \
|
||||
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
|
||||
-v /usr/local/dcmi:/usr/local/dcmi \
|
||||
-e ASCEND_RT_VISIBLE_DEVICES="0,1,2,3,4,5,6,7" \
|
||||
ccr-2vdh3abv-pub.cnc.bj.baidubce.com/device/paddle-npu:cann800-ubuntu20-npu-910b-base-$(uname -m)-gcc84 /bin/bash
|
||||
```
|
||||
## 2、安装paddle包
|
||||
* 下载安装 wheel 安装包
|
||||
```bash
|
||||
# 注意需要先安装飞桨 cpu 版本
|
||||
python -m pip install paddlepaddle==3.0.0.dev20250527 -i https://www.paddlepaddle.org.cn/packages/nightly/cpu
|
||||
python -m pip install paddle-custom-npu==3.0.0.dev20250527 -i https://www.paddlepaddle.org.cn/packages/nightly/npu
|
||||
```
|
||||
* CANN-8.0.0 对 numpy 和 opencv 部分版本不支持,建议安装指定版本
|
||||
```bash
|
||||
python -m pip install numpy==1.26.4
|
||||
python -m pip install opencv-python==3.4.18.65
|
||||
```
|
||||
* arm机器上需要设置环境变量(x86环境无需设置)
|
||||
```bash
|
||||
# 解决libgomp在arm机器上报错
|
||||
# "libgomp cannot allocate memory in static TLS block"
|
||||
export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1:$LD_PRELOAD
|
||||
```
|
||||
* 验证安装包安装完成之后,运行如下命令
|
||||
```bash
|
||||
python -c "import paddle; paddle.utils.run_check()"
|
||||
```
|
||||
预期得到如下输出结果
|
||||
|
||||
```
|
||||
Running verify PaddlePaddle program ...
|
||||
PaddlePaddle works well on 1 npu.
|
||||
PaddlePaddle works well on 8 npus.
|
||||
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
|
||||
```
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
# Kunlun XPU PaddlePaddle Installation Tutorial
|
||||
|
||||
Currently, PaddleOCR supports Kunlun R200/R300 and other chips. Considering environmental differences, we recommend using the <b>Kunlun XPU development image officially released by PaddlePaddle</b>, which is pre-installed with the Kunlun basic runtime environment library (XRE).
|
||||
|
||||
## 1. Docker Environment Preparation
|
||||
Pull the image. This image is only for the development environment and does not include a pre-compiled PaddlePaddle installation package.
|
||||
|
||||
```bash
|
||||
docker pull registry.baidubce.com/device/paddle-xpu:ubuntu20-x86_64-gcc84-py310 # For X86 architecture
|
||||
docker pull registry.baidubce.com/device/paddle-xpu:kylinv10-aarch64-gcc82-py310 # For ARM architecture
|
||||
```
|
||||
Refer to the following command to start the container:
|
||||
|
||||
```bash
|
||||
docker run -it --name=xxx -m 81920M --memory-swap=81920M \
|
||||
--shm-size=128G --privileged --net=host \
|
||||
-v $(pwd):/workspace -w /workspace \
|
||||
registry.baidubce.com/device/paddle-xpu:$(uname -m)-py310 bash
|
||||
```
|
||||
|
||||
## 2. Install Paddle Package
|
||||
Currently, Python3.10 wheel installation packages are provided. If you have a need for other Python versions, you can refer to the [PaddlePaddle official documentation](https://www.paddlepaddle.org.cn/en/install/quick) to compile and install them yourself.
|
||||
|
||||
Install the Python3.10 wheel installation package:
|
||||
|
||||
```bash
|
||||
pip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_x86_64.whl # For X86 architecture
|
||||
pip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_aarch64.whl # For ARM architecture
|
||||
```
|
||||
|
||||
Verify the installation package. After installation, run the following command:
|
||||
|
||||
```bash
|
||||
python -c "import paddle; paddle.utils.run_check()"
|
||||
```
|
||||
|
||||
The expected output is:
|
||||
|
||||
```
|
||||
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
|
||||
```
|
||||
@@ -0,0 +1,42 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
# 昆仑 XPU 飞桨安装教程
|
||||
|
||||
当前 PaddleOCR 支持昆仑 R200/R300 等芯片。考虑到环境差异性,我们推荐使用<b>飞桨官方发布的昆仑 XPU 开发镜像</b>,该镜像预装有昆仑基础运行环境库(XRE)。
|
||||
|
||||
## 1、docker环境准备
|
||||
拉取镜像,此镜像仅为开发环境,镜像中不包含预编译的飞桨安装包
|
||||
|
||||
```
|
||||
docker pull registry.baidubce.com/device/paddle-xpu:ubuntu20-x86_64-gcc84-py310 # X86 架构
|
||||
docker pull registry.baidubce.com/device/paddle-xpu:kylinv10-aarch64-gcc82-py310 # ARM 架构
|
||||
```
|
||||
参考如下命令启动容器
|
||||
|
||||
```
|
||||
docker run -it --name=xxx -m 81920M --memory-swap=81920M \
|
||||
--shm-size=128G --privileged --net=host \
|
||||
-v $(pwd):/workspace -w /workspace \
|
||||
registry.baidubce.com/device/paddle-xpu:$(uname -m)-py310 bash
|
||||
```
|
||||
## 2、安装paddle包
|
||||
当前提供 Python3.10 的 wheel 安装包。如有其他 Python 版本需求,可以参考[飞桨官方文档](https://www.paddlepaddle.org.cn/install/quick)自行编译安装。
|
||||
|
||||
安装 Python3.10 的 wheel 安装包
|
||||
|
||||
```
|
||||
pip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_x86_64.whl # X86 架构
|
||||
pip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_aarch64.whl # ARM 架构
|
||||
```
|
||||
验证安装包 安装完成之后,运行如下命令
|
||||
|
||||
```
|
||||
python -c "import paddle; paddle.utils.run_check()"
|
||||
```
|
||||
预期得到如下输出结果
|
||||
|
||||
```
|
||||
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
|
||||
```
|
||||
Reference in New Issue
Block a user