We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I prefer using faster whisper, if you need to do demo with it too, here is the revised code:
import argparse import torch import os import pickle from args import get_args_parser, MODEL_DIR import whisper from faster_whisper import WhisperModel, decode_audio import whisperx from typing import TypedDict class SingleSegment(TypedDict): """ A single segment (up to multiple sentences) of a speech. """ start: float end: float text: str # Args parser = argparse.ArgumentParser(parents=[get_args_parser()]) args = parser.parse_args() device = torch.device(args.device) print("load Whisper model") asr_model = WhisperModel("large-v3",device="cuda", compute_type="float16") print("extract ASR") asr = asr_model.transcribe(args.video_example,without_timestamps=True,word_timestamps=False, beam_size=5,initial_prompt='Please! add punctuations。',vad_filter=True) print("load align model") align_model, metadata = whisperx.load_align_model(language_code=asr[1].language, device=args.device, model_dir=MODEL_DIR) print("extract audio") audio = whisperx.load_audio(args.video_example) print("align ASR") the_segments = [] for segment in asr[0]: s_item = {'text':segment.text,'start':segment.start,'end':segment.end} the_segments.append(s_item) print(the_segments[:3]) print("whisperx.......") aligned_asr = whisperx.align(the_segments, align_model, metadata, audio, args.device, return_char_alignments=False) print("saving") pickle.dump(aligned_asr, open(args.asr_example, 'wb'))
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I prefer using faster whisper, if you need to do demo with it too, here is the revised code:
The text was updated successfully, but these errors were encountered: