forked from agokrani/distillKitPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (54 loc) · 2.2 KB
/
Copy pathDockerfile
File metadata and controls
65 lines (54 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
FROM nvidia/cuda:12.4.0-devel-ubuntu22.04
# Set non-interactive frontend for apt-get to avoid prompts
ARG DEBIAN_FRONTEND=noninteractive
# Set working directory
WORKDIR /app
# Install system dependencies
# Using python3.11 based on modal's add_python="3.11"
RUN apt-get update && \
apt-get install -y --no-install-recommends git python3.11 python3-pip python3.11-dev && \
rm -rf /var/lib/apt/lists/*
# Update pip and setuptools
RUN python3.11 -m pip install --no-cache-dir --upgrade pip setuptools wheel
# Install Python packages
# Combine dependencies for better layer caching
RUN python3.11 -m pip install --no-cache-dir \
accelerate \
transformers==4.49.0 \
torch==2.5.1 --index-url https://download.pytorch.org/whl/cu121 \
datasets \
tensorboard \
trl==0.15.2 \
bitsandbytes \
tensorflow \
h5py \
tf-keras \
deepspeed==0.16.4 \
"huggingface_hub[hf_transfer]" \
click
# Install peft from specific commit
RUN python3.11 -m pip install --no-cache-dir \
git+https://github.com/agokrani/peft.git@fix-for-modules-to-save-for-zero3#egg=peft
# Install flash-attn
# Note: FlashAttention installation can be hardware-specific and might require compilation.
# Ensure the base image and environment are compatible.
# Using --no-build-isolation as specified in the modal script.
RUN python3.11 -m pip install --no-cache-dir flash-attn --no-build-isolation
# Copy application code
COPY scripts /app/scripts
COPY components /app/components
COPY config /app/config
# Set environment variables
ENV HF_HUB_ENABLE_HF_TRANSFER=1
ENV CUDA_LAUNCH_BLOCKING=1
ENV TORCH_USE_CUDA_DSA=1
# Set Python path if needed, although usually not necessary when using WORKDIR
# ENV PYTHONPATH=/app
# Ensure python points to python3.11
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1
# Set default command - runs the local script.
# Assumes scripts/local/distill_logits.py is the main execution script.
# User should override the config path if needed, e.g., docker run <image> --config /path/to/my_config.json
# Or mount their config file to /app/config/default_config.json
ENTRYPOINT ["python", "scripts/local/distill_logits.py"]
CMD ["--config", "config/default_config.json"]