视频连接

本期视频内容

本期视频教你如何免费使用谷歌Colab提供的英伟达T4 GPU,实现高效的机器学习项目训练和语音识别任务。视频中以Whisper语音识别项目为例,展示如何利用Colab环境搭建和运行一键脚本快速生成字幕,且分享了如何将数据挂载到谷歌云盘保存,保证断线数据不丢失的实用技巧。此外,还介绍了如何通过简单的操作提升环境准备速度,大幅提高实用性。适合对机器学习、视频字幕自动生成感兴趣的同学,尤其是想省钱利用云GPU资源的朋友们。

谷歌colab网站

谷歌colab网站

whisper-webui运行环境的谷歌云盘连接

https://drive.google.com/file/d/1OmL5T1jlD7SPCNSa0bT2ulXV0j06NIU2/view?usp=sharing

一键脚本

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# 语法
curl -fsSL https://raw.githubusercontent.com/ericwang2006/whisper-webui/refs/heads/main/whisper.sh | bash -s -- --input <文件名> [--engine whisper|faster-whisper] [--model medium] [--language Chinese]

# 示例
curl -fsSL https://raw.githubusercontent.com/ericwang2006/whisper-webui/refs/heads/main/whisper.sh | bash -s -- \
--input 054.mp4

# 指定语言(默认Chinese)
curl -fsSL https://raw.githubusercontent.com/ericwang2006/whisper-webui/refs/heads/main/whisper.sh | bash -s -- \
--input 054.mp4 \
--language Japanese

# 使用faster-whisper(默认whisper)
curl -fsSL https://raw.githubusercontent.com/ericwang2006/whisper-webui/refs/heads/main/whisper.sh | bash -s -- \
--input 054.mp4 \
--engine faster-whisper

# 使用大模型(默认medium)
curl -fsSL https://raw.githubusercontent.com/ericwang2006/whisper-webui/refs/heads/main/whisper.sh | bash -s -- \
--input 054.mp4 \
--model large

虚拟环境镜像制作方法

如果不想用我提供的whisperenv.img,也可以自己制作python虚拟环境,以下代码在Colab虚拟机中执行

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
cd /content
python3 -m venv whisperenv --without-pip
source whisperenv/bin/activate  # 激活虚拟环境
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py  # 手动安装pip

git clone --depth 1 https://github.com/ericwang2006/whisper-webui.git
cd whisper-webui
pip install -r requirements-whisper.txt
pip install -r requirements-fasterWhisper.txt
deactivate

cd /content
dd if=/dev/zero of=whisperenv.img bs=1M count=8192 status=progress
mkfs.ext4 whisperenv.img
mkdir -p /mnt/whisperenv
apt-get update && apt-get install fuseext2 -y
fuseext2 whisperenv.img /mnt/whisperenv -o rw+
cp -R whisperenv/* /mnt/whisperenv/
fusermount -uz /mnt/whisperenv/
# 把whisperenv.img复制到自己的谷歌云盘即可

已经制作好的成品下载

谷歌云盘 |夸克网盘 |Pikpak网盘

实用命令

查看显卡信息

1
nvidia-smi

安全卸载谷歌云盘(防止虚拟机关闭后文件缓冲区中有文件未写入谷歌云盘)

1
2
3
# 在代码单元格中运行以下代码
from google.colab import drive
drive.flush_and_unmount()

相关项目

whisper-webui

whisper-webui Docker镜像


资源推荐

音乐频道
Telegram频道:Morning Dawn Music
专注高质量音乐分享,坚持每天更新!

VPS推荐
VULTR | 搬瓦工

自用机场
追风岛【中端/大厂】

个人频道与网站
YouTube | 哔哩哔哩 | 抖音 | Telegram | 个人网站

合作联系
邮箱:fs104300@outlook.com