AbhinavGupta commited on
Commit
670a149
Β·
verified Β·
1 Parent(s): 4c236e2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -3
Dockerfile CHANGED
@@ -6,18 +6,32 @@ RUN apt-get update && apt-get install -y \
6
 
7
  RUN useradd -m -u 1000 user
8
  USER user
 
9
  ENV PATH="/home/user/.local/bin:$PATH"
10
- WORKDIR /app
 
 
11
 
 
12
  COPY --chown=user requirements.txt .
13
 
14
- # ── Single chained command β€” prevents partial cache hits ──
15
  RUN pip install --no-cache-dir \
16
  torch==2.3.0+cpu \
17
  torchvision==0.18.0+cpu \
18
  --index-url https://download.pytorch.org/whl/cpu \
19
  && pip install --no-cache-dir -r requirements.txt \
20
- && python -c "import torch; import torchvision; print('βœ… torch', torch.__version__, '| torchvision', torchvision.__version__)"
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  COPY --chown=user . .
23
  EXPOSE 7860
 
6
 
7
  RUN useradd -m -u 1000 user
8
  USER user
9
+
10
  ENV PATH="/home/user/.local/bin:$PATH"
11
+ # Force transformers to trust the installed torch/torchvision
12
+ ENV FORCE_TORCH_AVAILABLE=1
13
+ ENV TOKENIZERS_PARALLELISM=false
14
 
15
+ WORKDIR /app
16
  COPY --chown=user requirements.txt .
17
 
 
18
  RUN pip install --no-cache-dir \
19
  torch==2.3.0+cpu \
20
  torchvision==0.18.0+cpu \
21
  --index-url https://download.pytorch.org/whl/cpu \
22
  && pip install --no-cache-dir -r requirements.txt \
23
+ && python -c "
24
+ import torch, torchvision, transformers
25
+ print('torch:', torch.__version__)
26
+ print('torchvision:', torchvision.__version__)
27
+ print('transformers:', transformers.__version__)
28
+ from transformers.utils import is_torch_available, is_torchvision_available
29
+ print('torch detected by transformers:', is_torch_available())
30
+ print('torchvision detected by transformers:', is_torchvision_available())
31
+ assert is_torch_available(), 'FATAL: transformers cannot detect torch'
32
+ assert is_torchvision_available(), 'FATAL: transformers cannot detect torchvision'
33
+ print('βœ… All checks passed')
34
+ "
35
 
36
  COPY --chown=user . .
37
  EXPOSE 7860