当前位置: 首页 > news >正文

whisperX 安装及测试

仓库地址:https://github.com/m-bain/whisperX

安装步骤

pip install whisperx
pip install ctranslate2==4.5.0

容易遇到报错:
Unable to load any of {libcudnn_cnn.so.9.1.0, libcudnn_cnn.so.9.1, libcudnn_cnn.so.9, libcudnn_cnn.so}

conda install -c conda-forge cudnn
import whisperx
import gc
from whisperx.diarize import DiarizationPipelinedevice = "cuda"
audio_file = "audio.mp3"
batch_size = 16 # reduce if low on GPU mem
compute_type = "float16" # change to "int8" if low on GPU mem (may reduce accuracy)# 1. Transcribe with original whisper (batched)
model = whisperx.load_model("large-v2", device, compute_type=compute_type)# save model to local path (optional)
# model_dir = "/path/"
# model = whisperx.load_model("large-v2", device, compute_type=compute_type, download_root=model_dir)audio = whisperx.load_audio(audio_file)
result = model.transcribe(audio, batch_size=batch_size)
print(result["segments"]) # before alignment# delete model if low on GPU resources
# import gc; import torch; gc.collect(); torch.cuda.empty_cache(); del model# 2. Align whisper output
model_a, metadata = whisperx.load_align_model(language_code=result["language"], device=device)
result = whisperx.align(result["segments"], model_a, metadata, audio, device, return_char_alignments=False)print(result["segments"]) # after alignment# delete model if low on GPU resources
# import gc; import torch; gc.collect(); torch.cuda.empty_cache(); del model_a# 3. Assign speaker labels
diarize_model = DiarizationPipeline(use_auth_token=YOUR_HF_TOKEN, device=device)# add min/max number of speakers if known
diarize_segments = diarize_model(audio)
# diarize_model(audio, min_speakers=min_speakers, max_speakers=max_speakers)result = whisperx.assign_word_speakers(diarize_segments, result)
print(diarize_segments)
print(result["segments"]) # segments are now assigned speaker IDs
http://www.dtcms.com/a/594486.html

相关文章:

  • 建立网站一般那些阶段成都工信部网站
  • 手机网站页面文字做多大网站开发课表查询
  • Python数据挖掘之聚类
  • 企业做网站需要注意事项广西建设安全员证查询网站
  • 网站统计WordPress轻量企业主题
  • 花都网站建设哪家好电子商务网站建设期末试题08答案
  • Node-RED生态中的Sparkplug B社区节点介绍
  • pyspark入门实操(收藏版)
  • 可以在家做兼职的网站做招聘信息的网站有哪些方面
  • 织梦网站图片修改不了网站建设专业性
  • 手机网站最小宽度网络文化经营许可证变更
  • 模板网站与定制网站的价格小蝌蚪视频网络科技有限公司
  • 基于Python Tkinter的批量IP地址归属地查询
  • 网站排名优化价格私人网络服务器
  • 资源网站优化排名北京网络营销网站
  • 如何做简单的网站wordpress分页阅读
  • 做网站软件 wordpage贵阳哪里做网站
  • 优秀网站模板欣赏行业网站建设公司推荐
  • iTwin UI
  • 虚拟主机和网站的关系西安大型网站制作
  • 积极推进在线网站建设网站运营计划书
  • 远程网页调试工具实战:跨端前端调试的核心利器与最佳实践
  • (二)Docker实战--Docker镜像部署与启动
  • 【ZeroRange WebRTC】对称加密 vs 非对称加密(从原理到实践)
  • 网站建设逻辑长沙网络营销群
  • 你们交学费做网站局机关门户网站建设自查报告范文
  • 腾讯企点网页版山东网站排名优化公司
  • 网站地图有什么作用陕西seo顾问服务
  • openai 的 codex
  • 国内网如何看国外网站南阳河南网站建设价格