tommulder commited on
Commit
6735521
·
1 Parent(s): 80e4bb4

Docker: guard flash-attn install by Python ABI tag; skip on mismatch

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -2
Dockerfile CHANGED
@@ -49,9 +49,16 @@ COPY --chown=user requirements.txt .
49
  RUN pip install --no-cache-dir -r requirements.txt
50
 
51
  # Optionally install flash-attn wheel (requires Python/torch/CUDA compatibility)
 
52
  RUN if [ "$INSTALL_FLASH_ATTN" = "true" ]; then \
53
- echo "Installing flash-attn from $FLASH_ATTN_WHEEL_URL" && \
54
- pip install --no-cache-dir $FLASH_ATTN_WHEEL_URL; \
 
 
 
 
 
 
55
  else \
56
  echo "Skipping flash-attn installation"; \
57
  fi
 
49
  RUN pip install --no-cache-dir -r requirements.txt
50
 
51
  # Optionally install flash-attn wheel (requires Python/torch/CUDA compatibility)
52
+ # Will auto-skip if the wheel's Python tag does not match this image's Python.
53
  RUN if [ "$INSTALL_FLASH_ATTN" = "true" ]; then \
54
+ PYTAG=$(python -c "import sys; print(f'cp{sys.version_info.major}{sys.version_info.minor}')"); \
55
+ echo "Detected Python tag: $PYTAG"; \
56
+ if echo "$FLASH_ATTN_WHEEL_URL" | grep -q "$PYTAG"; then \
57
+ echo "Installing flash-attn from $FLASH_ATTN_WHEEL_URL" && \
58
+ pip install --no-cache-dir "$FLASH_ATTN_WHEEL_URL"; \
59
+ else \
60
+ echo "flash-attn wheel tag mismatch for $PYTAG. Skipping flash-attn install. Override FLASH_ATTN_WHEEL_URL if needed."; \
61
+ fi; \
62
  else \
63
  echo "Skipping flash-attn installation"; \
64
  fi