awacke1 commited on
Commit
36a5e47
·
1 Parent(s): 0667abe

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +51 -0
Dockerfile ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Builds GPU docker image of PyTorch
2
+ # Uses multi-staged approach to reduce size
3
+ # Stage 1
4
+ # Use base conda image to reduce time
5
+ FROM continuumio/miniconda3:latest AS compile-image
6
+ # Specify py version
7
+ ENV PYTHON_VERSION=3.8
8
+ # Install apt libs - copied from https://github.com/huggingface/accelerate/blob/main/docker/accelerate-gpu/Dockerfile
9
+ RUN apt-get update && \
10
+ apt-get install -y curl git wget software-properties-common git-lfs && \
11
+ apt-get clean && \
12
+ rm -rf /var/lib/apt/lists*
13
+
14
+ # Install audio-related libraries
15
+ RUN apt-get update && \
16
+ apt install -y ffmpeg
17
+
18
+ RUN apt install -y libsndfile1-dev
19
+ RUN git lfs install
20
+
21
+ # Create our conda env - copied from https://github.com/huggingface/accelerate/blob/main/docker/accelerate-gpu/Dockerfile
22
+ RUN conda create --name peft python=${PYTHON_VERSION} ipython jupyter pip
23
+ RUN python3 -m pip install --no-cache-dir --upgrade pip
24
+
25
+ # Below is copied from https://github.com/huggingface/accelerate/blob/main/docker/accelerate-gpu/Dockerfile
26
+ # We don't install pytorch here yet since CUDA isn't available
27
+ # instead we use the direct torch wheel
28
+ ENV PATH /opt/conda/envs/peft/bin:$PATH
29
+ # Activate our bash shell
30
+ RUN chsh -s /bin/bash
31
+ SHELL ["/bin/bash", "-c"]
32
+ # Activate the conda env and install transformers + accelerate from source
33
+ RUN source activate peft && \
34
+ python3 -m pip install --no-cache-dir \
35
+ librosa \
36
+ "soundfile>=0.12.1" \
37
+ scipy \
38
+ git+https://github.com/huggingface/transformers \
39
+ git+https://github.com/huggingface/accelerate \
40
+ peft[test]@git+https://github.com/huggingface/peft
41
+
42
+ # Install apt libs
43
+ RUN apt-get update && \
44
+ apt-get install -y curl git wget && \
45
+ apt-get clean && \
46
+ rm -rf /var/lib/apt/lists*
47
+
48
+ RUN echo "source activate peft" >> ~/.profile
49
+
50
+ # Activate the virtualenv
51
+ CMD ["/bin/bash"]