fix: Use flexible PyTorch versions and fix Docker build order

- Don't pin exact torch/torchaudio/torchvision versions (use >=2.1.0)
- Install CUDA PyTorch first in Docker before other requirements
- Upgrade pip before installations to avoid compatibility issues
- Let pip resolve latest compatible versions from cu118 index
This commit is contained in:
Your Name
2026-01-05 10:50:20 -05:00
parent c5cc7c2969
commit 78e9df31e6
2 changed files with 14 additions and 12 deletions

View File

@ -15,16 +15,17 @@ RUN apt-get update && apt-get install -y \
# Copy requirements first for better Docker layer caching
COPY requirements.txt .
# Install CPU versions from requirements.txt first
RUN pip install --no-cache-dir -r requirements.txt
# Upgrade pip first to avoid installation issues
RUN pip install --upgrade pip
# Install CUDA-optimized PyTorch (overwrites CPU versions)
# Updated to torch 2.1.0+ for SpeechBrain 1.0 / pyannote diarization compatibility
RUN pip install --force-reinstall \
torch==2.1.0+cu118 \
torchvision==0.16.0+cu118 \
torchaudio==2.1.0+cu118 \
--index-url https://download.pytorch.org/whl/cu118
# Install CUDA-optimized PyTorch FIRST (before other requirements)
# Using latest versions from cu118 index for SpeechBrain 1.0 / pyannote diarization compatibility
# Not pinning versions - pip will resolve latest compatible versions from the index
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
# Install remaining dependencies from requirements.txt
# Skip torch/torchvision/torchaudio since they're already installed
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .

View File

@ -8,9 +8,10 @@ humanize>=4.6.0
# PyTorch ecosystem - updated for SpeechBrain 1.0 compatibility
# torchaudio >= 2.1.0 is REQUIRED for diarization to work properly
torch==2.1.0
torchaudio==2.1.0
torchvision==0.16.0
# NOTE: For Docker GPU builds, these are installed separately from cu118 index
torch>=2.1.0
torchaudio>=2.1.0
torchvision>=0.16.0
# Transformers ecosystem - compatible versions
transformers==4.35.0