YashashMathur commited on
Commit
524f673
·
verified ·
1 Parent(s): f5ca8fb

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -17
Dockerfile CHANGED
@@ -19,31 +19,31 @@ USER user
19
  ENV PATH="/home/user/.local/bin:${PATH}"
20
  WORKDIR /home/user/app
21
 
22
- # PIP Installation Sequence (Crucial)
23
- # a. pip install --upgrade pip
 
 
 
24
  RUN python3 -m pip install --upgrade pip
25
 
26
- # b. pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu121
27
- RUN python3 -m pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu121
28
 
29
- # c. pip uninstall -y torchao (ensure it is gone)
30
- RUN python3 -m pip uninstall -y torchao
31
 
32
- # d. pip install --no-deps "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
33
- RUN python3 -m pip install --no-deps "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
34
 
35
- # d.1 Install unsloth_zoo (required dependency for unsloth to work)
36
  RUN python3 -m pip install unsloth_zoo
37
 
38
- # e. pip install --no-deps xformers==0.0.27 trl==0.11.0 peft accelerate bitsandbytes
39
- RUN python3 -m pip install --no-deps xformers==0.0.27 trl==0.11.0 peft accelerate bitsandbytes
40
-
41
- # f. Fix transformers version (unsloth_zoo needs specific version - 4.46.x works)
42
- RUN python3 -m pip install transformers==4.46.3
43
 
44
- # Install other requirements
45
  COPY --chown=user:user requirements.txt .
46
- RUN python3 -m pip install -r requirements.txt
47
 
48
  # Copy application code
49
  COPY --chown=user:user train.py .
@@ -51,4 +51,4 @@ COPY --chown=user:user aegis_training_data_500.json .
51
 
52
  EXPOSE 7860
53
 
54
- CMD ["python3", "-u", "train.py"]
 
19
  ENV PATH="/home/user/.local/bin:${PATH}"
20
  WORKDIR /home/user/app
21
 
22
+ # ============================================================
23
+ # FIXED Installation Order - Critical for unsloth compatibility
24
+ # ============================================================
25
+
26
+ # a. Upgrade pip first
27
  RUN python3 -m pip install --upgrade pip
28
 
29
+ # b. Install torch with CUDA 12.1 (MUST come first)
30
+ RUN python3 -m pip install torch==2.3.1+cu121 torchvision==0.18.1+cu121 torchaudio==2.3.1+cu121 --index-url https://download.pytorch.org/whl/cu121
31
 
32
+ # c. Install transformers (MUST be 4.44.x - 4.46.x for unsloth_zoo)
33
+ RUN python3 -m pip install transformers==4.44.2
34
 
35
+ # d. Install unsloth (core only, not the git version)
36
+ RUN python3 -m pip install unsloth
37
 
38
+ # e. Install unsloth_zoo (required dependency)
39
  RUN python3 -m pip install unsloth_zoo
40
 
41
+ # f. Install other required packages
42
+ RUN python3 -m pip install xformers==0.0.27 peft accelerate bitsandbytes datasets huggingface_hub wandb trl
 
 
 
43
 
44
+ # g. Install any remaining requirements
45
  COPY --chown=user:user requirements.txt .
46
+ RUN python3 -m pip install -r requirements.txt || true
47
 
48
  # Copy application code
49
  COPY --chown=user:user train.py .
 
51
 
52
  EXPOSE 7860
53
 
54
+ CMD ["python3", "-u", "train.py"]