File size: 851 Bytes
ace6209 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | """Minimal transcription example for GigaAM-He.
pip install torch torchaudio soundfile numpy
pip install git+https://github.com/salute-developers/GigaAM.git
python inference.py clip.wav
For anything longer than ~20 s use server.py, which segments first: the model
is trained on segments up to 20 s and a longer input degrades rather than
failing loudly.
"""
import sys
import gigaam
CHECKPOINT = "gigaam-he-twostage.ckpt"
def main() -> None:
if len(sys.argv) < 2:
print(__doc__)
raise SystemExit(2)
model = gigaam.load_model(CHECKPOINT, device="cuda", fp16_encoder=False)
for path in sys.argv[1:]:
result = model.transcribe(path)
text = getattr(result, "transcription", None) or getattr(result, "text", str(result))
print(f"{path}: {text}")
if __name__ == "__main__":
main()
|