garvitsachdeva commited on
Commit
0c3df82
Β·
1 Parent(s): 82cc86d

fix: install nvidia-cudnn-cu12 alongside CUDA torch (removes --no-deps)

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -19,19 +19,21 @@ print("=== PYTHON STARTED ===", flush=True)
19
 
20
  # ── Force CUDA torch before any `import torch` happens in this process ─────────
21
  # requirements.txt installs CPU torch as a transitive dep of sentence-transformers.
22
- # --force-reinstall overrides "already satisfied"; --no-deps only touches torch.
 
23
  # This subprocess runs before gradio (and therefore before any torch import).
24
- print("Installing CUDA torch (force)...", flush=True)
25
  _cuda_r = subprocess.run(
26
  [sys.executable, "-m", "pip", "install", "-q",
27
- "--force-reinstall", "--no-deps",
28
  "--index-url", "https://download.pytorch.org/whl/cu121",
 
29
  "torch"],
30
  capture_output=True, text=True,
31
- timeout=300,
32
  )
33
  if _cuda_r.returncode == 0:
34
- print("CUDA torch installed OK.", flush=True)
35
  else:
36
  print("CUDA torch install FAILED:", _cuda_r.stderr[-400:], flush=True)
37
 
 
19
 
20
  # ── Force CUDA torch before any `import torch` happens in this process ─────────
21
  # requirements.txt installs CPU torch as a transitive dep of sentence-transformers.
22
+ # --force-reinstall overrides "already satisfied" and also installs nvidia-cudnn-cu12
23
+ # and other CUDA runtime packages needed by the LSTM kernel (cuDNN).
24
  # This subprocess runs before gradio (and therefore before any torch import).
25
+ print("Installing CUDA torch + cuDNN...", flush=True)
26
  _cuda_r = subprocess.run(
27
  [sys.executable, "-m", "pip", "install", "-q",
28
+ "--force-reinstall",
29
  "--index-url", "https://download.pytorch.org/whl/cu121",
30
+ "--extra-index-url", "https://pypi.org/simple",
31
  "torch"],
32
  capture_output=True, text=True,
33
+ timeout=600,
34
  )
35
  if _cuda_r.returncode == 0:
36
+ print("CUDA torch + cuDNN installed OK.", flush=True)
37
  else:
38
  print("CUDA torch install FAILED:", _cuda_r.stderr[-400:], flush=True)
39