Skip to content

Commit a189035

Browse files
committed
Add a Dockerfile and document usage in README
1 parent 23ed990 commit a189035

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

Dockerfile.cpu

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM tensorflow/tensorflow:1.12.0-py3
2+
3+
ENV LANG=C.UTF-8
4+
RUN mkdir /gpt-2
5+
WORKDIR /gpt-2
6+
COPY requirements.txt download_model.sh /gpt-2/
7+
RUN apt-get update && \
8+
apt-get install -y curl && \
9+
sh download_model.sh 117M
10+
RUN pip3 install -r requirements.txt
11+
12+
ADD . /gpt-2

Dockerfile.gpu

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM tensorflow/tensorflow:1.12.0-gpu-py3
2+
3+
# nvidia-docker 1.0
4+
LABEL com.nvidia.volumes.needed="nvidia_driver"
5+
LABEL com.nvidia.cuda.version="${CUDA_VERSION}"
6+
7+
# nvidia-container-runtime
8+
ENV NVIDIA_VISIBLE_DEVICES=all \
9+
NVIDIA_DRIVER_CAPABILITIES=compute,utility \
10+
NVIDIA_REQUIRE_CUDA="cuda>=8.0" \
11+
LANG=C.UTF-8
12+
13+
RUN mkdir /gpt-2
14+
WORKDIR /gpt-2
15+
COPY requirements.txt download_model.sh /gpt-2/
16+
RUN apt-get update && \
17+
apt-get install -y curl && \
18+
sh download_model.sh 117M
19+
RUN pip3 install -r requirements.txt
20+
21+
ADD . /gpt-2

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Git clone this repository, and `cd` into directory for remaining commands
1313
git clone https://github.com/openai/gpt-2.git && cd gpt-2
1414
```
1515

16+
### Native Installation
17+
1618
Download the model data
1719
```
1820
sh download_model.sh 117M
@@ -34,6 +36,21 @@ Install other python packages:
3436
pip3 install -r requirements.txt
3537
```
3638

39+
### Docker Installation
40+
41+
Build the Dockerfile and tag the created image as `gpt-2`:
42+
```
43+
docker build --tag gpt-2 -f Dockerfile.gpu . # or Dockerfile.cpu
44+
```
45+
46+
Start an interactive bash session from the `gpt-2` docker image.
47+
48+
You can opt to use the `--runtime=nvidia` flag if you have access to a NVIDIA GPU
49+
and a valid install of [nvidia-docker 2.0](https://github.com/nvidia/nvidia-docker/wiki/Installation-(version-2.0)).
50+
```
51+
docker run --runtime=nvidia -it gpt-2 bash
52+
```
53+
3754
## Usage
3855

3956
| WARNING: Samples are unfiltered and may contain offensive content. |

0 commit comments

Comments
 (0)