JulianPhillips commited on
Commit
71ba2e2
·
verified ·
1 Parent(s): 7686cad

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -15
Dockerfile CHANGED
@@ -1,36 +1,32 @@
1
  # Base image with PyTorch and CUDA for GPU support
2
  FROM pytorch/pytorch:1.10.0-cuda11.3-cudnn8-runtime
3
 
4
- # Install system dependencies and Git LFS for large model files
5
  RUN apt-get update && apt-get install -y \
6
  git \
7
  wget \
8
- git-lfs \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- # Install Python packages including Hugging Face Transformers and Flask
12
  RUN pip install --no-cache-dir \
13
  torch \
14
  torchvision \
15
- transformers \
16
  requests \
17
  Flask
18
 
19
- # Set Hugging Face cache to a writable directory
20
- ENV TRANSFORMERS_CACHE=/app/cache
21
- RUN mkdir -p /app/cache
22
 
23
- # Create a working directory for model files
24
  RUN mkdir -p /models/sapiens_pose /models/motionbert
25
 
26
- # Download Meta Sapiens Pose model using Git LFS
27
- RUN git lfs install && \
28
- git clone https://huggingface.co/facebook/sapiens-pose-1b-torchscript /models/sapiens_pose && \
29
- ls /models/sapiens_pose # List contents to verify download
30
 
31
- # Download MotionBERT model using Git LFS
32
- RUN git clone https://huggingface.co/walterzhu/MotionBERT /models/motionbert && \
33
- ls /models/motionbert # List contents to verify download
34
 
35
  # Copy the inference script (app.py) into the container
36
  COPY app.py /app/app.py
 
1
  # Base image with PyTorch and CUDA for GPU support
2
  FROM pytorch/pytorch:1.10.0-cuda11.3-cudnn8-runtime
3
 
4
+ # Install system dependencies and Hugging Face CLI
5
  RUN apt-get update && apt-get install -y \
6
  git \
7
  wget \
 
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
+ # Install Python packages including Hugging Face Transformers, TorchScript, and Flask
11
  RUN pip install --no-cache-dir \
12
  torch \
13
  torchvision \
14
+ transformers[cli] \
15
  requests \
16
  Flask
17
 
18
+ # Set Hugging Face cache to a guaranteed writable directory
19
+ ENV TRANSFORMERS_CACHE=/tmp/cache
20
+ RUN mkdir -p /tmp/cache
21
 
22
+ # Download models using Hugging Face CLI and place them in specified directories
23
  RUN mkdir -p /models/sapiens_pose /models/motionbert
24
 
25
+ # Download Meta Sapiens Pose model to /models/sapiens_pose
26
+ RUN transformers-cli download facebook/sapiens-pose-1b-torchscript -d /models/sapiens_pose
 
 
27
 
28
+ # Download MotionBERT model to /models/motionbert
29
+ RUN transformers-cli download walterzhu/MotionBERT -d /models/motionbert
 
30
 
31
  # Copy the inference script (app.py) into the container
32
  COPY app.py /app/app.py