Malina Claude Opus 4.8 commited on
Commit
57dbdb2
·
1 Parent(s): e2c96b8

NINA: fix Space build — torch/torchaudio 2.11 matched pair; pyannote token kwarg

Browse files

torchaudio has no 2.12 release (max 2.11), and it pins an exact torch, so pin both
to 2.11.0. Keep pyannote.audio 3.3.2 (no torchcodec; compatible with hub 1.15).
Make diarization auth robust to the hub token/use_auth_token rename.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Files changed (2) hide show
  1. diarize.py +5 -1
  2. requirements.txt +5 -2
diarize.py CHANGED
@@ -27,7 +27,11 @@ def _get_pipeline():
27
  try:
28
  import torch
29
  from pyannote.audio import Pipeline
30
- _pipeline = Pipeline.from_pretrained(DIARIZATION_MODEL, use_auth_token=HF_TOKEN)
 
 
 
 
31
  if _pipeline is None: # happens when the token lacks gated access
32
  raise RuntimeError("pipeline is None — has the HF token accepted the gated "
33
  "pyannote terms?")
 
27
  try:
28
  import torch
29
  from pyannote.audio import Pipeline
30
+ # huggingface-hub renamed use_auth_token → token; support both.
31
+ try:
32
+ _pipeline = Pipeline.from_pretrained(DIARIZATION_MODEL, token=HF_TOKEN)
33
+ except TypeError:
34
+ _pipeline = Pipeline.from_pretrained(DIARIZATION_MODEL, use_auth_token=HF_TOKEN)
35
  if _pipeline is None: # happens when the token lacks gated access
36
  raise RuntimeError("pipeline is None — has the HF token accepted the gated "
37
  "pyannote terms?")
requirements.txt CHANGED
@@ -12,8 +12,11 @@ Pillow==12.2.0
12
  langdetect==1.0.9 # robust prompt-language detection (answer in user's language)
13
 
14
  # ── ML / inference ──
15
- torch==2.12.0
16
- torchaudio==2.12.0 # bundled Hybrid Demucs (vocal isolation) + pyannote backend
 
 
 
17
  pyannote.audio==3.3.2 # speaker diarization (gated: accept the model terms on HF)
18
  sentence-transformers==5.5.1
19
  transformers==5.8.1
 
12
  langdetect==1.0.9 # robust prompt-language detection (answer in user's language)
13
 
14
  # ── ML / inference ──
15
+ # torch is 2.11.0 (not 2.12) because torchaudio — needed for vocal isolation +
16
+ # pyannote — has no 2.12 release; torchaudio pins an exact torch, so they move as a
17
+ # matched pair.
18
+ torch==2.11.0
19
+ torchaudio==2.11.0 # bundled Hybrid Demucs (vocal isolation) + pyannote backend
20
  pyannote.audio==3.3.2 # speaker diarization (gated: accept the model terms on HF)
21
  sentence-transformers==5.5.1
22
  transformers==5.8.1