Whisper-AT 项目使用教程

Whisper-AT 项目使用教程

whisper-atCode and Pretrained Models for Interspeech 2023 Paper "Whisper-AT: Noise-Robust Automatic Speech Recognizers are Also Strong Audio Event Taggers"项目地址:https://gitcode.com/gh_mirrors/wh/whisper-at

1. 项目的目录结构及介绍

Whisper-AT 项目的目录结构如下:

whisper-at/
├── README.md
├── requirements.txt
├── setup.py
├── whisper_at/
│   ├── __init__.py
│   ├── model.py
│   ├── utils.py
│   └── ...
├── examples/
│   ├── example1.py
│   ├── example2.py
│   └── ...
├── tests/
│   ├── test_model.py
│   ├── test_utils.py
│   └── ...
└── ...

目录结构介绍

  • README.md: 项目说明文档。
  • requirements.txt: 项目依赖文件。
  • setup.py: 项目安装脚本。
  • whisper_at/: 核心代码目录,包含模型、工具等模块。
    • __init__.py: 模块初始化文件。
    • model.py: 模型定义文件。
    • utils.py: 工具函数文件。
  • examples/: 示例代码目录,包含多个使用示例。
  • tests/: 测试代码目录,包含多个测试脚本。

2. 项目的启动文件介绍

项目的启动文件主要是 examples/ 目录下的示例脚本。以下是一个典型的启动文件示例:

# examples/example1.py

import whisper_at as whisper

# 设置音频标签的时间分辨率
audio_tagging_time_resolution = 10

# 加载模型
model = whisper.load_model("large-v1")

# 识别音频文件
result = model.transcribe("audio.mp3", at_time_res=audio_tagging_time_resolution)

# 输出ASR结果
print(result["text"])

# 输出音频标签结果
audio_tag_result = whisper.parse_at_label(result, language='follow_asr', top_k=5, p_threshold=-1, include_class_list=list(range(527)))
print(audio_tag_result)

启动文件介绍

  • import whisper_at as whisper: 导入 Whisper-AT 模块。
  • audio_tagging_time_resolution = 10: 设置音频标签的时间分辨率。
  • model = whisper.load_model("large-v1"): 加载预训练模型。
  • result = model.transcribe("audio.mp3", at_time_res=audio_tagging_time_resolution): 识别音频文件并输出结果。
  • print(result["text"]): 输出ASR结果。
  • audio_tag_result = whisper.parse_at_label(...): 解析音频标签结果并输出。

3. 项目的配置文件介绍

项目的配置文件主要是 requirements.txtsetup.py

requirements.txt

requirements.txt 文件列出了项目运行所需的所有依赖包:

numba
numpy
torch
tqdm
more-itertools
tiktoken==0.3.3

setup.py

setup.py 文件用于项目的安装和打包:

from setuptools import setup, find_packages

setup(
    name='whisper-at',
    version='0.1.0',
    packages=find_packages(),
    install_requires=[
        'numba',
        'numpy',
        'torch',
        'tqdm',
        'more-itertools',
        'tiktoken==0.3.3'
    ],
    entry_points={
        'console_scripts': [
            'whisper-at=whisper_at.cli:main',
        ],
    },
)

配置文件介绍

  • requirements.txt: 列出了项目运行所需的所有依赖包。
  • setup.py: 用于项目的安装和打包,定义了项目名称、版本、依赖包和入口点。

以上是 Whisper-AT 项目的使用教程,涵盖了项目的目录结构、启动文件和配置文件的介绍。希望对您有所帮助!

whisper-atCode and Pretrained Models for Interspeech 2023 Paper "Whisper-AT: Noise-Robust Automatic Speech Recognizers are Also Strong Audio Event Taggers"项目地址:https://gitcode.com/gh_mirrors/wh/whisper-at

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

郭蔷意Ward

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值