Commit 13d30a4f authored by myhloli's avatar myhloli

docs(readme): update PyTorch installation guide for CUDA 11.8

Update the PyTorch installation command in the README files for both English and Chinese
versions to reflect the required version compatibility with CUDA 11.8. Include explicit
instructions to specify the PyTorch version to avoid automatic installation of higher,
unsupported versions. Additionally, clarify the importance of modifying the "device-mode"
parameter in the magic-pdf.json configuration file for proper CUDA device selection.
parent fd60393d
...@@ -151,14 +151,15 @@ If you have an available Nvidia GPU or are using a Mac with Apple Silicon, you c ...@@ -151,14 +151,15 @@ If you have an available Nvidia GPU or are using a Mac with Apple Silicon, you c
You need to install the corresponding PyTorch version according to your CUDA version. You need to install the corresponding PyTorch version according to your CUDA version.
This example installs the CUDA 11.8 version.More information https://pytorch.org/get-started/locally/ This example installs the CUDA 11.8 version.More information https://pytorch.org/get-started/locally/
```bash
pip install --force-reinstall torch==2.3.1 torchvision==0.18.1 --index-url https://download.pytorch.org/whl/cu118
```
> ❗ ️Make sure to specify version > ❗ ️Make sure to specify version
> ```bash > ```bash
> torch==2.3.1 torchvision==0.18.1 > torch==2.3.1 torchvision==0.18.1
> ``` > ```
> in the command, as these are the highest versions we support. Failing to specify the versions may result in automatically installing higher versions which can cause the program to fail. > in the command, as these are the highest versions we support. Failing to specify the versions may result in automatically installing higher versions which can cause the program to fail.
```bash
pip install --force-reinstall torch==2.3.1 torchvision==0.18.1 --index-url https://download.pytorch.org/whl/cu118
```
Also, you need to modify the value of "device-mode" in the configuration file magic-pdf.json. Also, you need to modify the value of "device-mode" in the configuration file magic-pdf.json.
```json ```json
{ {
......
...@@ -121,13 +121,17 @@ pip install detectron2 --extra-index-url https://myhloli.github.io/wheels/ -i ht ...@@ -121,13 +121,17 @@ pip install detectron2 --extra-index-url https://myhloli.github.io/wheels/ -i ht
#### 3. 拷贝配置文件并进行配置 #### 3. 拷贝配置文件并进行配置
在仓库根目录可以获得 [magic-pdf.template.json](magic-pdf.template.json) 配置模版文件 在仓库根目录可以获得 [magic-pdf.template.json](magic-pdf.template.json) 配置模版文件
> ❗️务必执行以下命令将配置文件拷贝到用户目录下,否则程序将无法运行 > ❗️务必执行以下命令将配置文件拷贝到【用户目录】下,否则程序将无法运行
>
> windows的用户目录为 "C:\Users\用户名", linux用户目录为 "/home/用户名", macOS用户目录为 "/Users/用户名"
```bash ```bash
cp magic-pdf.template.json ~/magic-pdf.json cp magic-pdf.template.json ~/magic-pdf.json
``` ```
在用户目录中找到magic-pdf.json文件并配置"models-dir"为[2. 下载模型权重文件](#2-下载模型权重文件)中下载的模型权重文件所在目录 在用户目录中找到magic-pdf.json文件并配置"models-dir"为[2. 下载模型权重文件](#2-下载模型权重文件)中下载的模型权重文件所在目录
> ❗️务必正确配置模型权重文件所在目录,否则会因为找不到模型文件而导致程序无法运行 > ❗️务必正确配置模型权重文件所在目录,否则会因为找不到模型文件而导致程序无法运行
>
> windows系统中应把路径中所有的"\"替换为"/",否则会因为转义原因导致json文件语法错误。
```json ```json
{ {
"models-dir": "/tmp/models" "models-dir": "/tmp/models"
...@@ -140,17 +144,17 @@ cp magic-pdf.template.json ~/magic-pdf.json ...@@ -140,17 +144,17 @@ cp magic-pdf.template.json ~/magic-pdf.json
需要根据自己的CUDA版本安装对应的pytorch版本 需要根据自己的CUDA版本安装对应的pytorch版本
以下是对应CUDA 11.8版本的安装命令,更多信息请参考 https://pytorch.org/get-started/locally/ 以下是对应CUDA 11.8版本的安装命令,更多信息请参考 https://pytorch.org/get-started/locally/
```bash
pip install --force-reinstall torch==2.3.1 torchvision==0.18.1 --index-url https://download.pytorch.org/whl/cu118
```
> ❗️务必在命令中指定以下版本 > ❗️务必在命令中指定以下版本
> ```bash > ```bash
> torch==2.3.1 torchvision==0.18.1 > torch==2.3.1 torchvision==0.18.1
> ``` > ```
> 这是我们支持的最高版本,如果不指定版本会自动安装更高版本导致程序无法运行 > 这是我们支持的最高版本,如果不指定版本会自动安装更高版本导致程序无法运行
```bash
pip install --force-reinstall torch==2.3.1 torchvision==0.18.1 --index-url https://download.pytorch.org/whl/cu118
```
同时需要修改配置文件magic-pdf.json中"device-mode"的值 同时需要修改【用户目录】中配置文件magic-pdf.json中"device-mode"的值
```json ```json
{ {
"device-mode":"cuda" "device-mode":"cuda"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment