Przeglądaj źródła

新增 PaddleX 本地安装教程,包含环境配置、Linux 安装步骤及启动脚本

zhch158_admin 3 miesięcy temu
rodzic
commit
0d7c327e92
1 zmienionych plików z 101 dodań i 0 usunięć
  1. 101 0
      zhch/study-notes.md

+ 101 - 0
zhch/study-notes.md

@@ -0,0 +1,101 @@
+# [PaddleX本地安装教程](https://paddlepaddle.github.io/PaddleX/latest/installation/installation.html)
+# 环境选择
+```
+git clone https://gitee.com/zhch158_admin/dots.ocr.git
+
+git config --local user.name "zhch158_admin"
+git config --local user.email "zhch158@sina.com"
+# 自定义缓存时间(如7200秒)
+git config --global credential.helper 'cache --timeout=7200'
+
+conda create -n py312 python=3.12
+# vllm目前最高支持到3.12
+
+```
+
+# Linux安装
+flash-attn 确实没有 macOS 的预编译包,因为 flash-attn 是专门为 NVIDIA GPU(CUDA)设计的,而 Mac 使用的是 Apple Silicon 或 Intel CPU,不支持 CUDA
+```
+cd dots.ocr
+
+conda activate py312
+uv pip install torch==2.7.0 torchvision==0.22.0 torchaudio==2.7.0 
+uv pip install -e .
+uv pip install vllm --torch-backend=auto
+
+# 解决vllm版本兼容问题,检查当前版本
+pip list | grep -E "(vllm|transformers)"
+# 使用最新兼容版本
+pip install --upgrade vllm transformers torch
+
+# 查看端口占用情况
+sudo lsof -i:8000
+
+# 显示所有监听的端口
+sudo ss -tuln
+
+# 显示特定端口
+sudo ss -tulpn | grep :8000
+
+# 显示进程信息
+sudo ss -tulpn sport = :8000
+```
+
+
+# 设置launch.json
+```json
+	"configurations": [
+		{
+			"name": "Python Debugger: Current File",
+			"type": "debugpy",
+			"request": "launch",
+			"program": "${file}",
+			"console": "integratedTerminal",
+			"cwd": "${fileDirname}",
+			"env": {"PYTHONPATH":"${workspaceFolder};${env:PYTHONPATH}"},
+			"envFile": "${workspaceFolder}/.env",
+			"justMyCode": false
+		},
+		{
+			"name": "app",
+			"type": "debugpy",
+			"request": "launch",
+			// "module": "paddlex.__main__",
+			"program": "${workspaceFolder}/zhch/paddlex_cli.py",
+			"console": "integratedTerminal",
+			"cwd": "${workspaceFolder}/zhch",
+			"env": {"PYTHONPATH":"${workspaceFolder};${env:PYTHONPATH}"},
+			"envFile": "${workspaceFolder}/.env",
+			"args": [
+				// "-m", "paddlex.paddlex_cli",
+				// "--get_pipeline_config", "${workspaceFolder}/zhch/PP-StructureV3-zhch.yaml"
+				"--pipeline", "PP-StructureV3",
+				"--use_doc_orientation_classify=True",
+				"--use_doc_unwarping=True",
+				"--input", "sample_data/300674-母公司现金流量表-扫描.png",
+				"--save_path", "sample_data/output",
+				"--device", "gpu",
+			],
+			"justMyCode": false
+		}
+	]
+```
+
+# 启动脚本
+zhch/launch_model_vllm.sh
+```
+# 监控内存使用情况
+watch -n 1 nvidia-smi
+
+```
+
+# 在线体验环境
+```
+https://dotsocr.xiaohongshu.com/
+```
+
+# macOS 查看显卡信息
+```
+# 使用 system_profiler 命令查看 GPU 信息
+system_profiler SPDisplaysDataType
+```