Skip to content

Instantly share code, notes, and snippets.

@fxmarty
Last active November 14, 2022 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fxmarty/39cb2a81453d48029185c89c0e8b19aa to your computer and use it in GitHub Desktop.
Save fxmarty/39cb2a81453d48029185c89c0e8b19aa to your computer and use it in GitHub Desktop.
Dockerfile to test torchdynamo
FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04
# to be used along https://github.com/sgugger/torchdynamo-tests
# build with `docker build -f Dockerfile -t container-torchdynamo .`
# run with `docker run --gpus device=4 -it -v $(pwd)/scripts:/workspace container-torchdynamo:latest python verify_dynamo.py`
# and then
# run with `docker run --gpus device=4 -it -v $(pwd)/scripts:/workspace container-torchdynamo:latest python benchmark.py --use-cuda`
# `verify_dynamo.py`: comes from https://github.com/sgugger/torchdynamo-tests
# `benchmark.py`: see https://gist.github.com/fxmarty/f9fbc34c9b04adcc92a142ef27923851
ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y wget && rm -rf /var/lib/apt/lists/*
RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& mkdir /root/.conda \
&& bash Miniconda3-latest-Linux-x86_64.sh -b \
&& rm -f Miniconda3-latest-Linux-x86_64.sh
RUN conda init bash
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
git && \
apt-get clean
RUN pip install --upgrade numpy
RUN pip install --pre torch[dynamo] --extra-index-url https://download.pytorch.org/whl/nightly/cu117/
RUN pip install transformers tqdm
# RUN pip install git+https://github.com/huggingface/accelerate.git#egg=accelerate
WORKDIR /workspace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment