Update README.md

This commit is contained in:
天涯古巷
2023-10-27 09:23:16 +08:00
committed by GitHub
parent 9b45f7a9c7
commit eb8ed8601e

134
README.md
View File

@@ -55,87 +55,81 @@ conda activate videoEnv
请确保你已经安装 python 3.8+使用conda创建项目虚拟环境并激活环境 (建议创建虚拟环境运行,以免后续出现问题)
- GPU用户(有N卡)
- 安装CUDA和cuDNN
- 安装CUDA和cuDNN
<details>
<summary>Linux用户</summary>
<details>
<summary>Linux用户</summary>
<h5>(1) 下载CUDA 11.7</h5>
<pre><code>wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run</code></pre>
<h5>(2) 安装CUDA 11.7</h5>
<pre><code>sudo sh cuda_11.7.0_515.43.04_linux.run</code></pre>
<p>1. 输入accept</p>
<img src="https://i.328888.xyz/2023/03/31/iwVoeH.png" width="500" alt="">
<p>2. 选中CUDA Toolkit 11.7如果你没有安装nvidia驱动则选中Driver如果你已经安装了nvidia驱动请不要选中driver之后选中install回车</p>
<img src="https://i.328888.xyz/2023/03/31/iwVThJ.png" width="500" alt="">
<p>3. 添加环境变量</p>
<p>在 ~/.bashrc 加入以下内容</p>
<pre><code># CUDA
export PATH=/usr/local/cuda-11.7/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}</code></pre>
<p>使其生效</p>
<pre><code>source ~/.bashrc</code></pre>
<h5>(3) 下载cuDNN 8.4.1</h5>
<p>国内:<a href="https://pan.baidu.com/s/1Gd_pSVzWfX1G7zCuqz6YYA">cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz</a> 提取码57mg</p>
<p>国外:<a href="https://github.com/YaoFANGUK/video-subtitle-extractor/releases/download/1.0.0/cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz">cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz</a></p>
<h5>(4) 安装cuDNN 8.4.1</h5>
<pre><code> tar -xf cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz
mv cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive cuda
sudo cp ./cuda/include/* /usr/local/cuda-11.7/include/
sudo cp ./cuda/lib/* /usr/local/cuda-11.7/lib64/
sudo chmod a+r /usr/local/cuda-11.7/lib64/*
sudo chmod a+r /usr/local/cuda-11.7/include/*</code></pre>
</details>
<details>
<summary>Windows用户</summary>
<h5>(1) 下载CUDA 11.7</h5>
<pre><code>wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run</code></pre>
<a href="https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_516.01_windows.exe">cuda_11.7.0_516.01_windows.exe</a>
<h5>(2) 安装CUDA 11.7</h5>
<pre><code>sudo sh cuda_11.7.0_515.43.04_linux.run</code></pre>
<p>1. 输入accept</p>
<img src="https://i.328888.xyz/2023/03/31/iwVoeH.png" width="500" alt="">
<p>2. 选中CUDA Toolkit 11.7如果你没有安装nvidia驱动则选中Driver如果你已经安装了nvidia驱动请不要选中driver之后选中install回车</p>
<img src="https://i.328888.xyz/2023/03/31/iwVThJ.png" width="500" alt="">
<p>3. 添加环境变量</p>
<p>在 ~/.bashrc 加入以下内容</p>
<pre><code># CUDA
export PATH=/usr/local/cuda-11.7/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}</code></pre>
<p>使其生效</p>
<pre><code>source ~/.bashrc</code></pre>
<h5>(3) 下载cuDNN 8.4.1</h5>
<p>国内:<a href="https://pan.baidu.com/s/1Gd_pSVzWfX1G7zCuqz6YYA">cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz</a> 提取码57mg</p>
<p>国外:<a href="https://github.com/YaoFANGUK/video-subtitle-extractor/releases/download/1.0.0/cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz">cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz</a></p>
<h5>(4) 安装cuDNN 8.4.1</h5>
<pre><code> tar -xf cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz
mv cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive cuda
sudo cp ./cuda/include/* /usr/local/cuda-11.7/include/
sudo cp ./cuda/lib/* /usr/local/cuda-11.7/lib64/
sudo chmod a+r /usr/local/cuda-11.7/lib64/*
sudo chmod a+r /usr/local/cuda-11.7/include/*</code></pre>
<h5>(3) 下载cuDNN 8.2.4</h5>
<p><a href="https://github.com/YaoFANGUK/video-subtitle-extractor/releases/download/1.0.0/cudnn-windows-x64-v8.2.4.15.zip">cudnn-windows-x64-v8.2.4.15.zip</a></p>
<h5>(4) 安装cuDNN 8.2.4</h5>
<p>
将cuDNN解压后的cuda文件夹中的bin, include, lib目录下的文件复制到C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\对应目录下
</p>
</details>
<details>
<summary>Windows用户</summary>
<h5>(1) 下载CUDA 11.7</h5>
<a href="https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_516.01_windows.exe">cuda_11.7.0_516.01_windows.exe</a>
<h5>(2) 安装CUDA 11.7</h5>
<h5>(3) 下载cuDNN 8.2.4</h5>
<p><a href="https://github.com/YaoFANGUK/video-subtitle-extractor/releases/download/1.0.0/cudnn-windows-x64-v8.2.4.15.zip">cudnn-windows-x64-v8.2.4.15.zip</a></p>
<h5>(4) 安装cuDNN 8.2.4</h5>
<p>
将cuDNN解压后的cuda文件夹中的bin, include, lib目录下的文件复制到C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\对应目录下
</p>
</details>
- 安装paddlepaddle:
- 安装GPU版本Paddlepaddle:
- windows:
- windows:
```shell
python -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html
```
```shell
python -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html
```
- Linux:
- Linux:
```shell
python -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html
```
```shell
python -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html
```
> 如果安装cuda 10.2请对应安装7.6.5的cuDNN并使用对应cuda版本的paddlepaddle**请不要使用cuDNN v8.x 和 cuda 10.2的组合**
> 如果安装cuda 11.2请对应安装8.1.1的cuDNN并使用对应cuda版本的paddlepaddle**30系列以上的显卡驱动可能不支持 cuda 11.2及以下版本的安装**
- 安装GPU版本Pytorch:
```shell
conda install pytorch==2.0.1 torchvision==0.15.2 pytorch-cuda=11.7 -c pytorch -c nvidia
```
或者使用
```shell
pip install torch==2.0.1 torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cu117
```
- 安装GPU版本Pytorch:
```shell
conda install pytorch==2.0.1 torchvision==0.15.2 pytorch-cuda=11.7 -c pytorch -c nvidia
```
或者使用
```shell
pip install torch==2.0.1 torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cu117
```
- 安装其他依赖:
- 安装其他依赖:
```shell
pip install -r requirements.txt
```
```shell
pip install -r requirements.txt
```
#### 4. 运行程序
@@ -145,3 +139,9 @@ conda activate videoEnv
python ./backend/main.py
```
## 常见问题
1. CondaHTTPError
将项目中的.condarc放在用户目录下(C:\Users\<你的用户名>),如果用户目录已经存在该文件则覆盖
解决方案https://zhuanlan.zhihu.com/p/260034241