Document Ubuntu torch/pip recovery for requirements-whisper-stt.txt

- Add conda-first PyTorch install and broken-torch uninstall steps
- Mirror guidance in README for OSError / missing ATen.h during pip

Made-with: Cursor
This commit is contained in:
dosangyoon
2026-03-23 11:38:55 +09:00
parent 1c25bed926
commit c90230053a
2 changed files with 44 additions and 10 deletions

View File

@@ -81,6 +81,26 @@ conda activate stt
pip install -r requirements-whisper-stt.txt
```
**Ubuntu에서 `pip install -r requirements-whisper-stt.txt` 가 torch 관련 `OSError` / `ATen.h` 없음 등으로 실패할 때**
기존 `torch` 설치가 깨졌거나 pip가 교체 도중 멈춘 경우가 많습니다.
```bash
conda activate stt # 또는 사용 중인 env (예: ncue)
pip uninstall -y torch torchvision torchaudio
pip uninstall -y torch torchvision torchaudio # Skipping만 나올 때까지 반복
pip cache purge
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install -r requirements-whisper-stt.txt
```
애초에 꼬이지 않게 하려면 **PyTorch를 conda로 먼저** 깐 뒤 위 requirements만 pip로 설치하는 것을 권장합니다.
```bash
conda activate stt
conda install pytorch torchaudio cpuonly -c pytorch -y
pip install -r requirements-whisper-stt.txt
```
- **Hugging Face `hf` CLI**: `pip install huggingface_hub``hf auth login`, `hf download …` (화자 구분용 pyannote 모델 등).
- **화자 구분(기본 켜짐)**: `./models/pyannote-diarization-3.1` 에 pyannote 스냅샷이 있어야 합니다. 없으면 스크립트가 `hf download` 안내 후 종료합니다. 모델 받기: [pyannote/speaker-diarization-3.1](https://huggingface.co/pyannote/speaker-diarization-3.1) 약관 동의 후 `hf auth login`, `hf download … --local-dir ./models/pyannote-diarization-3.1`. 다른 경로는 `--diarize-model-dir` 또는 `WHISPER_DIARIZE_MODEL_DIR` 로 지정.
- **화자 구분 끄기**: `python whisper_stt.py 입력.m4a 출력.txt --no-diarize` (Whisper 통문만 저장)

View File

@@ -1,17 +1,31 @@
# 권장: conda activate stt 후 설치 (프로젝트 기본 환경)
# whisper_stt.py (OpenAI Whisper CLI) — 선택 설치
# 기본: pip install openai-whisper imageio-ffmpeg
# 화자 구분(--diarize): pyannote.audio
#
# CLI: pip install 후 PATH에 hf 가 잡혀야 함 (conda env 활성화)
# pip install huggingface_hub
# ── Ubuntu/Linux 권장 순서 (torch 깨짐·OSError 방지) ─────────────────────────
# pyannote가 pip로 torch를 덮어쓰다가 기존 torch와 꼬이면
# "Could not install ... ATen.h" 같은 오류가 날 수 있습니다.
#
# 모델 받기 (택 1)
# A) 허브 직접: pyannote/speaker-diarization-3.1 약관 동의 후
# hf auth login # 또는 HF_TOKEN — 실행 시 자동 캐시
# B) 로컬 폴더(이후 HF_TOKEN 불필요): 한 번 받아 두기
# hf download pyannote/speaker-diarization-3.1 --local-dir ./models/pyannote-diarization-3.1
# python whisper_stt.py in.wav out.txt --diarize --diarize-model-dir ./models/pyannote-diarization-3.1
# 1) 새 환경에서 PyTorch를 conda로 먼저 깔고, 그다음 pip:
# conda create -n stt python=3.11 -y
# conda activate stt
# conda install pytorch torchaudio cpuonly -c pytorch -y
# pip install -r requirements-whisper-stt.txt
#
# 2) 이미 깨진 경우(위 오류가 난 뒤) 복구:
# conda activate stt # 또는 ncue 등 해당 env
# pip uninstall -y torch torchvision torchaudio
# pip uninstall -y torch torchvision torchaudio # "WARNING: Skipping" 나올 때까지 반복
# pip cache purge
# pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu
# pip install -r requirements-whisper-stt.txt
#
# GPU(CUDA) 쓰는 경우: https://pytorch.org/get-started/locally/ 에서 맞는 pip/conda 명령 사용
#
# CLI: PATH에 hf — pip install huggingface_hub 후 hf auth login
#
# 모델: hf download pyannote/speaker-diarization-3.1 --local-dir ./models/pyannote-diarization-3.1
# (약관 동의·토큰 필요). whisper_stt.py 기본이 이 로컬 폴더 사용.
# ─────────────────────────────────────────────────────────────────────────────
openai-whisper
imageio-ffmpeg
huggingface_hub>=0.26.0