fast-hebrew-asr / inference.py
asfberlin's picture
GigaAM-He: Hebrew CTC recogniser, weights + OpenAI-compatible server
b3aedfd verified
Raw
History Blame Contribute Delete
851 Bytes
"""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()