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

Update install.md #763

Merged
merged 2 commits into from Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 30 additions & 9 deletions docs/en/install.md
@@ -1,8 +1,8 @@
## Prerequisites

- Linux (Windows is not officially supported)
- Linux / Windows / Mac
- Python 3.6+
- PyTorch 1.3 or higher
- PyTorch 1.5 or higher
- CUDA 9.0 or higher
- NCCL 2
- GCC 5.4 or higher
Expand All @@ -13,17 +13,22 @@
a. Create a conda virtual environment and activate it.

```shell
conda create -n open-mmlab python=3.7 -y
conda create -n open-mmlab python=3.8 -y
conda activate open-mmlab
```

b. Install PyTorch and torchvision following the [official instructions](https://pytorch.org/), e.g.,
b. Install PyTorch and torchvision following the [official instructions](https://pytorch.org/), then install mmcv-full

e.g. `cuda 10.1` & `pytorch 1.7`,

```shell
conda install pytorch torchvision -c pytorch
conda install pytorch==1.7.1 torchvision cudatoolkit=10.1 -c pytorch
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7/index.html "opencv-python<=4.5.4.60"
```

Note: Make sure that your compilation CUDA version and runtime CUDA version match.
Note 1: Higher version `opencv-python` is not supported.

Note 2: Make sure that your compilation CUDA version and runtime CUDA version match.
You can check the supported CUDA version for precompiled packages on the [PyTorch website](https://pytorch.org/).

`E.g. 1` If you have CUDA 10.1 installed under `/usr/local/cuda`, you need to install the prebuilt PyTorch with CUDA 10.1.
Expand All @@ -39,9 +44,6 @@ PyTorch 1.3.1., you need to install the prebuilt PyTorch with CUDA 9.2.
conda install pytorch=1.3.1 cudatoolkit=9.2 torchvision=0.4.2 -c pytorch
```

If you build PyTorch from source instead of installing the prebuilt package,
you can use more CUDA versions such as 9.0.

c. Clone the mmediting repository.

```shell
Expand All @@ -62,6 +64,18 @@ If you build mmediting on macOS, replace the last command with
CC=clang CXX=clang++ CFLAGS='-stdlib=libc++' pip install -e .
```

e. Verify installation

After the installation is complete, you can switch to another directory (such as `/home`) and try to import mmedit in python. If the import is successful, the installation is successful.

```shell
$ cd ~
$ python
>>> import mmedit
>>> mmedit.__version__
'0.12.0'
```

Note:

1. The git commit id will be written to the version number with step d, e.g. 0.6.0+2e7045c. The version will also be saved in trained models.
Expand All @@ -85,6 +99,13 @@ you can install it before installing MMCV.
### Install with CPU only
The code can be built for CPU only environment (where CUDA isn't available).

Accordingly, install the CPU version of PyTorch and MMCV.

```shell
conda install pytorch==1.7.1 torchvision cudatoolkit=10.1 -c pytorch
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7/index.html "opencv-python<=4.5.4.60"
```

<!-- In CPU mode you can run the demo/webcam_demo.py for example. -->
However some functionality is gone in this mode:

Expand Down
43 changes: 33 additions & 10 deletions docs/zh_cn/install.md
@@ -1,29 +1,34 @@
## 依赖

- Linux (目前 Windows 暂无官方支持)
- Linux / Windows / Mac
- Python 3.6+
- PyTorch 1.3 或更高
- PyTorch 1.5 或更高
- CUDA 9.0 或更高
- NCCL 2
- GCC 5.4 或更高
- [mmcv](https://github.com/open-mmlab/mmcv)

## 安装

a. 创建并激活 conda 虚拟环境,如:
a. 创建并激活 conda 虚拟环境,如 `python 3.8`

```shell
conda create -n open-mmlab python=3.7 -y
conda activate open-mmlab
conda create -n mmedit python=3.8 -y
conda activate mmedit
```

b. 按照 [PyTorch 官方文档](https://pytorch.org/) 安装 PyTorch 和 torchvision,如:
b. 按照 [PyTorch 官方文档](https://pytorch.org/) 安装 PyTorch 和 torchvision,然后安装对应路径下的 `mmcv-full`

如 `cuda 10.1` & `pytorch 1.7`:

```shell
conda install pytorch torchvision -c pytorch
conda install pytorch==1.7.1 torchvision cudatoolkit=10.1 -c pytorch
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7/index.html "opencv-python<=4.5.4.60"
```

注:确保 CUDA 编译版本和 CUDA 运行版本相匹配。 用户可以参照 [PyTorch 官网](https://pytorch.org/) 对预编译包所支持的 CUDA 版本进行核对。
注 1:过高版本的 `opencv-python` 在使用中存在一些问题,因此在安装时限制其版本。

注 2:确保 CUDA 编译版本和 CUDA 运行版本相匹配。 用户可以参照 [PyTorch 官网](https://pytorch.org/) 对预编译包所支持的 CUDA 版本进行核对。

`例1`:如果 `/usr/local/cuda` 文件夹下已安装了 CUDA 10.1 版本,则需要安装 CUDA 10.1 下预编译的 PyTorch。

Expand All @@ -36,8 +41,6 @@ conda install pytorch cudatoolkit=10.1 torchvision -c pytorch
conda install pytorch=1.3.1 cudatoolkit=9.2 torchvision=0.4.2 -c pytorch
```

如果你从源码编译 PyTorch 而不是安装的预编译版本的话,你可以使用更多 CUDA 版本(例如9.0)。

c. 克隆 MMEditing 仓库

```shell
Expand All @@ -58,6 +61,19 @@ pip install -v -e . # or "python setup.py develop"
CC=clang CXX=clang++ CFLAGS='-stdlib=libc++' pip install -e .
```

e. 验证安装

安装完成后,可以切换到其他目录(例如 `/home` 目录),并尝试在 python 中导入 mmedit,导入成功则证明安装成功

```shell
$ cd ~
$ python

>>> import mmedit
>>> mmedit.__version__
'0.12.0'
```

注:
1. git commit 的 id 将会被写到版本号中,如 0.6.0+2e7045c。这个版本号也会被保存到训练好的模型中。 推荐用户每次在对本地代码和 github 上的源码进行同步后,执行一次步骤 b。如果 C++/CUDA 代码被修改,就必须进行这一步骤。

Expand All @@ -81,6 +97,13 @@ CC=clang CXX=clang++ CFLAGS='-stdlib=libc++' pip install -e .

MMEditing 也可以在只有 CPU 的环境下安装(即无法使用 GPU 的环境)。

相应的,安装 CPU 版本的 PyTorch 和 MMCV

```shell
conda install pytorch==1.7.1 torchvision cudatoolkit=10.1 -c pytorch
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7/index.html "opencv-python<=4.5.4.60"
```

然而在该环境下,有些功能将被移除,例如:
- Deformable Convolution(可变形卷积)

Expand Down