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

windows基于cpu安装pytorch运行faster-whisper-large-v3实现语音转文字

1.创建虚拟环境
conda create -n faster-whisper python=3.10
conda activate faster-whisper

2.安装cpu版本的pytorch
pip3 install torch torchvision torchaudio -i https://pypi.tuna.tsinghua.edu.cn/simple

3.验证pytorch安装结果

(faster-whisper) H:\big-model\faster-whisper-large-v3>python
Python 3.10.16 | packaged by Anaconda, Inc. | (main, Dec 11 2024, 16:19:12) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import torch
>>> import torchvision
>>> import torchaudio
>>>
>>> print(f"PyTorch version: {torch.__version__}")
PyTorch version: 2.6.0+cpu
>>> print(f"torchvision version: {torchvision.__version__}")
torchvision version: 0.21.0+cpu
>>> print(f"torchaudio version: {torchaudio.__version__}")
torchaudio version: 2.6.0+cpu
>>> print(f"NumPy version: {torch.__version__}")
NumPy version: 2.6.0+cpu
>>>

4.安装ctranslate2和faster-whisper
pip3 install ctranslate2 faster-whisper -i https://pypi.tuna.tsinghua.edu.cn/simple

5.下载faster-whisper-large-v3模型
执行下面的python语句会去外网Hugging Face Hub自动下载,要翻墙,下载慢。

>>> model = WhisperModel("large-v3")

可以手动下载放到H:\big-model\faster-whisper-large-v3目录下

下载地址:https://huggingface.co/Systran/faster-whisper-large-v3/tree/main

6.测试语音转文字

>>> from faster_whisper import WhisperModel
>>> model_path = "H:\\big-model\\faster-whisper-large-v3"
>>> model = WhisperModel(model_path, device="cpu")
[2025-02-12 21:39:43.689] [ctranslate2] [thread 2996] [warning] The compute type inferred from the saved model is float16, but the target device or backend do not support efficient float16 computation. The model weights have been automatically converted to use the float32 compute type instead.
>>> 
>>>
>>> audio_file = "H:\\big-model\\audio\\628941565166328648.mp3"
>>> segments, info = model.transcribe(audio_file, beam_size=5)
>>> for segment in segments:
...     print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))
...
[0.00s -> 2.70s] 下面我们来看一下理财的三要素
[2.70s -> 6.38s] 安全性、流动性和收益性
[6.38s -> 11.94s] 世界上任何的投资行为都是在这三性中综合考量

done

http://www.dtcms.com/a/14368.html

相关文章:

  • 深入解析A2DP v1.4协议:蓝牙高质量音频传输的技术与实现
  • 【Java 面试 八股文】框架篇
  • Python + WhisperX:解锁语音识别的高效新姿势
  • 【C#】的WPF或是WinForm实现Ctrl+ 的快捷键组合使用
  • JAVA安全—Shiro反序列化DNS利用链CC利用链AES动态调试
  • 使用 EDOT 监测由 OpenAI 提供支持的 Python、Node.js 和 Java 应用程序
  • 自然语言处理NLP入门 -- 第二节预处理文本数据
  • c# http
  • 解释和对比“application/octet-stream“与“application/x-protobuf“
  • 普通用户授权docker使用权限
  • QTreeView笔记
  • 手动配置IP
  • idea如何使用AI编程提升效率-在IntelliJ IDEA 中安装 GitHub Copilot 插件的步骤-卓伊凡
  • ELK安装部署同步mysql数据
  • 解锁UniApp新姿势:巧用阿里巴巴字体图标库
  • RAII(Resource Acquisition Is Initialization)机制
  • [论文笔记] Deepseek-R1R1-zero技术报告阅读
  • Android10 音频参数导出合并
  • DeepSeek+即梦 做AI视频
  • Sonic Layer1
  • Golang GORM系列:GORM 高级查询教程
  • 【机器学习】线性回归 线性回归模型的损失函数 MSE RMSE MAE R方
  • Docker 安装指南:Windows、Mac、Linux
  • [HCTF 2018]WarmUp
  • 力扣--239.滑动窗口最大值
  • 基于物联网的智能蔬菜仓库设计(论文+源码)
  • C++ Primer 跳转语句
  • 知识管理成功:关键指标和策略,研究信息的投资回报率
  • Ansible中Playbook的逻辑控制语句-when
  • Leetcode 算法题 9 回文数