使用whisper转文本,这里使用的是large-v3版本
sql
pip install git+https://github.com/openai/whisper.git
python
import whisper
import os
from tqdm import tqdm
model = whisper.load_model("large-v3")
path = "rag_data"
for fi in tqdm(os.listdir(path)):
file = os.path.join(path, fi)
result = model.transcribe(file)
text = result["text"]
with open(os.path.join("rad_all_texts", file.split('.')[0] + ".txt"), 'a') as f:
f.write(text + '\n')
参考
Introducing Whisper
OpenAI Whisper 新一代语音技术(更新至v3)
fine-tune-whisper
Whisper-Finetune