Skip to content

Commit

Permalink
Add dockerfile and usage documentation (mli#29)
Browse files Browse the repository at this point in the history
* Add dockerfile and usage documentation

* add dockerfile.cuda

* Change dockerfile to use cpu version pytorch

* update readme.md

Co-authored-by: pgh <pgh@PGH-HOME>
  • Loading branch information
Guohui-Peng and pgh authored Nov 17, 2022
1 parent e77c585 commit 1eccfc2
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.9-slim as base

RUN mkdir /autocut
COPY ./ /autocut
WORKDIR /autocut

RUN apt update && \
apt install -y git && \
apt install -y ffmpeg

RUN pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu && \
pip install .
11 changes: 11 additions & 0 deletions Dockerfile.cuda
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM pytorch/pytorch:1.13.0-cuda11.6-cudnn8-runtime

RUN mkdir /autocut
COPY ./ /autocut
WORKDIR /autocut

RUN apt update && \
apt install -y git && \
apt install -y ffmpeg

RUN pip install .
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,44 @@ brew install ffmpeg
scoop install ffmpeg
```

## Docker安装

首先将项目克隆到本地。

```bash
git clone https://github.com/mli/autocut.git
```

### 安装CPU版本

进入项目根目录,然后构建docker映像。

```bash
docker build -t autocut .
```

运行下面的命令创建docker容器,就可以直接使用了。

```bash
docker run -it --rm -v E:\autocut:/autocut/video autocut /bin/bash
```

其中`-v`是将主机存放视频的文件夹`E:\autocut`映射到虚拟机的`/autocut/video`目录。`E:\autocut`是主机存放视频的目录,需修改为自己主机存放视频的目录。

### 安装GPU版本

使用GPU加速需要主机有Nvidia的显卡并安装好相应驱动。然后在项目根目录,执行下面的命令构建docker映像。

```bash
docker build -f ./Dockerfile.cuda -t autocut-gpu .
```

使用GPU加速时,运行docker容器需添加参数 `--gpus all`

```bash
docker run --gpus all -it --rm -v E:\autocut:/autocut/video autocut-gpu
```

## 更多使用选项

### 转录某个视频生成`.srt``.md`结果。
Expand Down

0 comments on commit 1eccfc2

Please sign in to comment.