Spaces:
Runtime error
Runtime error
Update demo.py
Browse files
demo.py
CHANGED
|
@@ -28,6 +28,7 @@ from utils import rotation_conversions as rc
|
|
| 28 |
import soundfile as sf
|
| 29 |
import librosa
|
| 30 |
import subprocess
|
|
|
|
| 31 |
from transformers import pipeline
|
| 32 |
from models.vq.model import RVQVAE
|
| 33 |
|
|
@@ -72,11 +73,13 @@ class BaseTrainer(object):
|
|
| 72 |
file.write(text)
|
| 73 |
|
| 74 |
# use montreal forced aligner to get textgrid
|
| 75 |
-
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
env = os.environ.copy()
|
| 78 |
-
env["PATH"] = f"{conda_bin}:{env.get('PATH', '')}"
|
| 79 |
-
mfa_path = f"{conda_bin}/mfa"
|
| 80 |
command = [mfa_path, "align", tmp_dir, "english_us_arpa", "english_us_arpa", tmp_dir]
|
| 81 |
result = subprocess.run(command, capture_output=True, text=True, env=env)
|
| 82 |
print(f"MFA result: {result}")
|
|
|
|
| 28 |
import soundfile as sf
|
| 29 |
import librosa
|
| 30 |
import subprocess
|
| 31 |
+
import shutil
|
| 32 |
from transformers import pipeline
|
| 33 |
from models.vq.model import RVQVAE
|
| 34 |
|
|
|
|
| 73 |
file.write(text)
|
| 74 |
|
| 75 |
# use montreal forced aligner to get textgrid
|
| 76 |
+
mfa_override = os.environ.get("MFA_BINARY")
|
| 77 |
+
mfa_path = mfa_override or shutil.which("mfa")
|
| 78 |
+
if not mfa_path:
|
| 79 |
+
raise FileNotFoundError(
|
| 80 |
+
"Montreal Forced Aligner binary not found. Install it or set MFA_BINARY"
|
| 81 |
+
)
|
| 82 |
env = os.environ.copy()
|
|
|
|
|
|
|
| 83 |
command = [mfa_path, "align", tmp_dir, "english_us_arpa", "english_us_arpa", tmp_dir]
|
| 84 |
result = subprocess.run(command, capture_output=True, text=True, env=env)
|
| 85 |
print(f"MFA result: {result}")
|