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

Add a Dockerfile and ignore example artifacts #15

Merged
merged 1 commit into from
Feb 20, 2019
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
12 changes: 12 additions & 0 deletions Dockerfile.cpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM tensorflow/tensorflow:1.12.0-py3

ENV LANG=C.UTF-8
RUN mkdir /gpt-2
WORKDIR /gpt-2
COPY requirements.txt download_model.sh /gpt-2/
RUN apt-get update && \
apt-get install -y curl && \
sh download_model.sh 117M
RUN pip3 install -r requirements.txt

ADD . /gpt-2
21 changes: 21 additions & 0 deletions Dockerfile.gpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM tensorflow/tensorflow:1.12.0-gpu-py3

# nvidia-docker 1.0
LABEL com.nvidia.volumes.needed="nvidia_driver"
LABEL com.nvidia.cuda.version="${CUDA_VERSION}"

# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES=all \
NVIDIA_DRIVER_CAPABILITIES=compute,utility \
NVIDIA_REQUIRE_CUDA="cuda>=8.0" \
LANG=C.UTF-8

RUN mkdir /gpt-2
WORKDIR /gpt-2
COPY requirements.txt download_model.sh /gpt-2/
RUN apt-get update && \
apt-get install -y curl && \
sh download_model.sh 117M
RUN pip3 install -r requirements.txt

ADD . /gpt-2
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Git clone this repository, and `cd` into directory for remaining commands
git clone https://github.com/openai/gpt-2.git && cd gpt-2
```

### Native Installation

Download the model data
```
sh download_model.sh 117M
Expand All @@ -34,6 +36,21 @@ Install other python packages:
pip3 install -r requirements.txt
```

### Docker Installation

Build the Dockerfile and tag the created image as `gpt-2`:
```
docker build --tag gpt-2 -f Dockerfile.gpu . # or Dockerfile.cpu
```

Start an interactive bash session from the `gpt-2` docker image.

You can opt to use the `--runtime=nvidia` flag if you have access to a NVIDIA GPU
and a valid install of [nvidia-docker 2.0](https://github.com/nvidia/nvidia-docker/wiki/Installation-(version-2.0)).
```
docker run --runtime=nvidia -it gpt-2 bash
```

## Usage

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