Last active
November 21, 2023 13:41
-
-
Save Vaibhavs10/312c1136d5a587e2f06ef645e5d44a4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import time | |
import torch | |
from transformers import pipeline | |
pipe = pipeline( | |
"automatic-speech-recognition", | |
"openai/whisper-large-v3", | |
torch_dtype=torch.float16, | |
device="mps", | |
) | |
start = time.time() | |
output = pipe( | |
"https://huggingface.co/datasets/reach-vb/random-audios/resolve/main/ted_60.wav", | |
chunk_length_s=30, | |
batch_size=24, | |
return_timestamps=True, | |
) | |
end = time.time() | |
print("Total time!") | |
print(end - start) | |
with open("output.json", "w", encoding="utf8") as fp: | |
json.dump(output, fp, ensure_ascii=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment