yusuke-ai's picture
Haas-ja-v1.0 OneCompression ONNX (int4/int8/fp32) with CPU inference code
e46a4b1
Raw History Blame Contribute Delete
771 Bytes
"""Transcribe one file locally, or download weights with an explicit --repo."""
import argparse
from huggingface_hub import snapshot_download
from haas_cpu.pipeline import Transcriber
from haas_cpu.external.audio_io import read_audio
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('audio')
parser.add_argument('--repo', help='Published Hugging Face model ID (download only)')
parser.add_argument('--format', choices=('int4-onecomp', 'int8', 'fp32'), default='int4-onecomp')
args = parser.parse_args()
models = snapshot_download(repo_id=args.repo) if args.repo else None
model = Transcriber(models, fmt=args.format, threads=4)
print(model.transcribe_long(read_audio(args.audio)).text)