修复并集成说话者分离功能
修复: - kb-whisper-diarization/whisper_diarization.py 变量名 bug 集成: - kb-workflow/SKILL.md 步骤5 添加说话者分离选项 - 自动检测 HF_TOKEN 选择识别模式 - 子技能清单添加 kb-whisper-diarization 文档: - kb-whisper-diarization/SKILL.md 完善 HF_TOKEN 获取步骤
This commit is contained in:
@@ -18,12 +18,36 @@
|
||||
| `WHISPER_CPP_PATH` | whisper.cpp 安装路径 | `~/whisper.cpp` |
|
||||
| `HF_TOKEN` | HuggingFace Token | `hf_xxx...` |
|
||||
|
||||
### 获取 HuggingFace Token
|
||||
### 获取 HuggingFace Token(必需)
|
||||
|
||||
pyannote.audio 需要从 HuggingFace 下载模型,需要先:
|
||||
1. 注册 HuggingFace 账号:https://huggingface.co
|
||||
2. 申请模型访问权限:https://huggingface.co/pyannote/speaker-diarization
|
||||
3. 创建 Token:https://huggingface.co/settings/tokens
|
||||
pyannote.audio 需要从 HuggingFace 下载模型,按以下步骤操作:
|
||||
|
||||
**步骤 1: 注册/登录 HuggingFace**
|
||||
- 访问 https://huggingface.co
|
||||
- 注册或登录账号
|
||||
|
||||
**步骤 2: 申请模型访问权限**
|
||||
需要申请以下两个模型的访问权限(点击页面上的 "Access repository" 按钮):
|
||||
- https://huggingface.co/pyannote/speaker-diarization
|
||||
- https://huggingface.co/pyannote/segmentation
|
||||
|
||||
> ⚠️ 申请后需要等待几分钟到几小时才能获得访问权限
|
||||
|
||||
**步骤 3: 创建 Access Token**
|
||||
1. 访问 https://huggingface.co/settings/tokens
|
||||
2. 点击 "New token"
|
||||
3. 选择 "Read" 权限
|
||||
4. 复制生成的 token(以 `hf_` 开头)
|
||||
|
||||
**步骤 4: 设置环境变量**
|
||||
```bash
|
||||
# 添加到 ~/.kb_env 文件
|
||||
echo 'export HF_TOKEN="hf_xxxxxxxxxxxxxxxxxxxxxx"' >> ~/.kb_env
|
||||
source ~/.kb_env
|
||||
|
||||
# 验证
|
||||
echo $HF_TOKEN
|
||||
```
|
||||
|
||||
## 使用方法
|
||||
|
||||
|
||||
@@ -320,7 +320,7 @@ def main():
|
||||
result = merge_results(whisper_txt, whisper_srt, diarization, output_dir, basename)
|
||||
|
||||
# 清理临时音频
|
||||
if audio_path != input_path and audio_path.endswith('_audio.wav'):
|
||||
if audio_path != input_file and audio_path.endswith('_audio.wav'):
|
||||
try:
|
||||
os.remove(audio_path)
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user