Upload d.py
Browse files
src/d.py
CHANGED
@@ -1,10 +1,5 @@
|
|
1 |
import os
|
2 |
# Set Hugging Face and Torch cache directories to /tmp (must be before any other imports)
|
3 |
-
os.environ["HF_HOME"] = "/tmp/huggingface"
|
4 |
-
os.environ["HF_HUB_CACHE"] = "/tmp/huggingface/hub"
|
5 |
-
os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface/transformers"
|
6 |
-
os.environ["TORCH_HOME"] = "/tmp/torch"
|
7 |
-
os.environ["XDG_CACHE_HOME"] = "/tmp/xdg_cache"
|
8 |
|
9 |
import yt_dlp
|
10 |
from pydub import AudioSegment
|
@@ -51,6 +46,12 @@ def debug_audio(audio_path):
|
|
51 |
def get_accent_classifier():
|
52 |
from speechbrain.pretrained.interfaces import foreign_class
|
53 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
cache_dir = "/tmp/pretrained_models"
|
55 |
if not hasattr(get_accent_classifier, "model"):
|
56 |
get_accent_classifier.model = foreign_class(
|
|
|
1 |
import os
|
2 |
# Set Hugging Face and Torch cache directories to /tmp (must be before any other imports)
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
import yt_dlp
|
5 |
from pydub import AudioSegment
|
|
|
46 |
def get_accent_classifier():
|
47 |
from speechbrain.pretrained.interfaces import foreign_class
|
48 |
import os
|
49 |
+
# Set all relevant cache dirs to /tmp to avoid permission errors
|
50 |
+
os.environ["HF_HOME"] = "/tmp/huggingface"
|
51 |
+
os.environ["HF_HUB_CACHE"] = "/tmp/huggingface/hub"
|
52 |
+
os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface/transformers"
|
53 |
+
os.environ["TORCH_HOME"] = "/tmp/torch"
|
54 |
+
os.environ["XDG_CACHE_HOME"] = "/tmp/xdg_cache"
|
55 |
cache_dir = "/tmp/pretrained_models"
|
56 |
if not hasattr(get_accent_classifier, "model"):
|
57 |
get_accent_classifier.model = foreign_class(
|