Luigi commited on
Commit
fa3fe1c
·
1 Parent(s): ad8872c

Use writable model cache for diarization models; vendor improved_diarization in src\

Browse files
Files changed (1) hide show
  1. src/diarization.py +6 -2
src/diarization.py CHANGED
@@ -19,6 +19,7 @@ from pathlib import Path
19
  from typing import List, Tuple, Optional, Callable, Dict, Any
20
  import streamlit as st
21
  import logging
 
22
 
23
  # Import the improved diarization pipeline (robust: search repo tree)
24
  try:
@@ -82,12 +83,15 @@ def download_diarization_models():
82
  Only downloads embedding model - we'll use Silero VAD for segmentation
83
  Returns tuple (embedding_model_path, success)
84
  """
85
- models_dir = Path("models/diarization")
 
 
86
  models_dir.mkdir(parents=True, exist_ok=True)
87
-
88
  # Updated to optimal Chinese/Taiwanese model from benchmark results
89
  # 3dspeaker_campplus_zh_en_advanced: F1=0.500, 60.5ms, 27MB
90
  embedding_model = models_dir / "3dspeaker_speech_campplus_sv_zh_en_16k-common_advanced.onnx"
 
91
 
92
  try:
93
  # Check if embedding model exists
 
19
  from typing import List, Tuple, Optional, Callable, Dict, Any
20
  import streamlit as st
21
  import logging
22
+ from utils import get_writable_model_dir
23
 
24
  # Import the improved diarization pipeline (robust: search repo tree)
25
  try:
 
83
  Only downloads embedding model - we'll use Silero VAD for segmentation
84
  Returns tuple (embedding_model_path, success)
85
  """
86
+ # Use a writable cache directory (works on HF Spaces and local)
87
+ cache_dir = get_writable_model_dir()
88
+ models_dir = cache_dir / "diarization"
89
  models_dir.mkdir(parents=True, exist_ok=True)
90
+
91
  # Updated to optimal Chinese/Taiwanese model from benchmark results
92
  # 3dspeaker_campplus_zh_en_advanced: F1=0.500, 60.5ms, 27MB
93
  embedding_model = models_dir / "3dspeaker_speech_campplus_sv_zh_en_16k-common_advanced.onnx"
94
+ st.info(f"Model cache directory: {models_dir}")
95
 
96
  try:
97
  # Check if embedding model exists