Delete egs/ami/ASR/xlsr_transducer/verify_setup.py
Browse files
egs/ami/ASR/xlsr_transducer/verify_setup.py
DELETED
|
@@ -1,150 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
"""
|
| 3 |
-
Quick verification script to check if all dependencies are available
|
| 4 |
-
before starting training.
|
| 5 |
-
"""
|
| 6 |
-
|
| 7 |
-
import sys
|
| 8 |
-
from pathlib import Path
|
| 9 |
-
|
| 10 |
-
def check_imports():
|
| 11 |
-
"""Check if all required packages are available."""
|
| 12 |
-
print("=" * 60)
|
| 13 |
-
print("Checking Python dependencies...")
|
| 14 |
-
print("=" * 60)
|
| 15 |
-
|
| 16 |
-
packages = {
|
| 17 |
-
"torch": "PyTorch",
|
| 18 |
-
"transformers": "HuggingFace Transformers (for XLSR)",
|
| 19 |
-
"sentencepiece": "SentencePiece",
|
| 20 |
-
"k2": "K2 (for transducer loss)",
|
| 21 |
-
"lhotse": "Lhotse (for data loading)",
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
missing = []
|
| 25 |
-
for package, name in packages.items():
|
| 26 |
-
try:
|
| 27 |
-
__import__(package)
|
| 28 |
-
print(f"✓ {name}")
|
| 29 |
-
except ImportError:
|
| 30 |
-
print(f"✗ {name} - MISSING!")
|
| 31 |
-
missing.append(package)
|
| 32 |
-
|
| 33 |
-
if missing:
|
| 34 |
-
print("\nMissing packages:")
|
| 35 |
-
for pkg in missing:
|
| 36 |
-
if pkg == "transformers":
|
| 37 |
-
print(f" pip install {pkg}")
|
| 38 |
-
else:
|
| 39 |
-
print(f" {pkg} (check icefall installation)")
|
| 40 |
-
return False
|
| 41 |
-
|
| 42 |
-
print("\n✓ All dependencies available!")
|
| 43 |
-
return True
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
def check_files():
|
| 47 |
-
"""Check if required data files exist."""
|
| 48 |
-
print("\n" + "=" * 60)
|
| 49 |
-
print("Checking required files...")
|
| 50 |
-
print("=" * 60)
|
| 51 |
-
|
| 52 |
-
files = {
|
| 53 |
-
"data/lang_bpe_500/bpe.model": "BPE model",
|
| 54 |
-
"data/lang_bpe_500/tokens.txt": "Token vocabulary",
|
| 55 |
-
"data/manifests/cuts_train_70h.jsonl.gz": "Training data (70h)",
|
| 56 |
-
"data/manifests/cuts_dev_ihm.jsonl.gz": "Development data",
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
missing = []
|
| 60 |
-
for file_path, name in files.items():
|
| 61 |
-
if Path(file_path).exists():
|
| 62 |
-
print(f"✓ {name}: {file_path}")
|
| 63 |
-
else:
|
| 64 |
-
print(f"✗ {name}: {file_path} - NOT FOUND!")
|
| 65 |
-
missing.append(file_path)
|
| 66 |
-
|
| 67 |
-
if missing:
|
| 68 |
-
print("\nMissing files. Please run data preparation:")
|
| 69 |
-
print(" cd /workspace/icefall/egs/ami/ASR")
|
| 70 |
-
print(" ./prepare.sh --stage 0 --stop-stage 7")
|
| 71 |
-
return False
|
| 72 |
-
|
| 73 |
-
print("\n✓ All required files exist!")
|
| 74 |
-
return True
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
def check_modules():
|
| 78 |
-
"""Check if local modules can be imported."""
|
| 79 |
-
print("\n" + "=" * 60)
|
| 80 |
-
print("Checking local modules...")
|
| 81 |
-
print("=" * 60)
|
| 82 |
-
|
| 83 |
-
try:
|
| 84 |
-
sys.path.insert(0, str(Path(__file__).parent))
|
| 85 |
-
|
| 86 |
-
# Try importing local modules
|
| 87 |
-
from xlsr_encoder import XLSREncoder
|
| 88 |
-
print("✓ xlsr_encoder.py")
|
| 89 |
-
|
| 90 |
-
from model import AsrModel
|
| 91 |
-
print("✓ model.py")
|
| 92 |
-
|
| 93 |
-
from decoder import Decoder
|
| 94 |
-
print("✓ decoder.py")
|
| 95 |
-
|
| 96 |
-
from joiner import Joiner
|
| 97 |
-
print("✓ joiner.py")
|
| 98 |
-
|
| 99 |
-
from asr_datamodule import AmiAsrDataModule
|
| 100 |
-
print("✓ asr_datamodule.py")
|
| 101 |
-
|
| 102 |
-
print("\n✓ All local modules can be imported!")
|
| 103 |
-
return True
|
| 104 |
-
|
| 105 |
-
except Exception as e:
|
| 106 |
-
print(f"\n✗ Error importing modules: {e}")
|
| 107 |
-
return False
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
def main():
|
| 111 |
-
print("\n" + "=" * 60)
|
| 112 |
-
print("XLSR-Transducer Setup Verification")
|
| 113 |
-
print("=" * 60)
|
| 114 |
-
|
| 115 |
-
checks = [
|
| 116 |
-
("Python Dependencies", check_imports),
|
| 117 |
-
("Data Files", check_files),
|
| 118 |
-
("Local Modules", check_modules),
|
| 119 |
-
]
|
| 120 |
-
|
| 121 |
-
all_passed = True
|
| 122 |
-
for name, check_func in checks:
|
| 123 |
-
if not check_func():
|
| 124 |
-
all_passed = False
|
| 125 |
-
|
| 126 |
-
print("\n" + "=" * 60)
|
| 127 |
-
if all_passed:
|
| 128 |
-
print("✓ All checks passed! Ready to train.")
|
| 129 |
-
print("=" * 60)
|
| 130 |
-
print("\nTo start training:")
|
| 131 |
-
print(" cd /workspace/icefall/egs/ami/ASR")
|
| 132 |
-
print(" ./xlsr_transducer/run.sh")
|
| 133 |
-
print("\nOr manually:")
|
| 134 |
-
print(" cd /workspace/icefall/egs/ami/ASR")
|
| 135 |
-
print(" export CUDA_VISIBLE_DEVICES=0")
|
| 136 |
-
print(" ./xlsr_transducer/train.py \\")
|
| 137 |
-
print(" --world-size 1 \\")
|
| 138 |
-
print(" --num-epochs 15 \\")
|
| 139 |
-
print(" --use-fp16 1 \\")
|
| 140 |
-
print(" --exp-dir xlsr_transducer/exp \\")
|
| 141 |
-
print(" --max-duration 100")
|
| 142 |
-
return 0
|
| 143 |
-
else:
|
| 144 |
-
print("✗ Some checks failed. Please fix the issues above.")
|
| 145 |
-
print("=" * 60)
|
| 146 |
-
return 1
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
if __name__ == "__main__":
|
| 150 |
-
sys.exit(main())
|
|
|
|
|
|
|
|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