Полностью локальный голосовой ассистент на Python. Стек: - Wake word: openWakeWord (onnxruntime) - STT: RealtimeSTT + faster-whisper + Silero VAD (CUDA) - LLM-агент: smolagents ToolCallingAgent + Ollama qwen2.5:7b - TTS: Silero V4 (torch.hub) + sounddevice - Shell: Git Bash (Windows) / bash (macOS) Поддерживает Windows и macOS. Агент с памятью и tool calling — находит программы самостоятельно, запоминает пути, выполняет произвольные shell-команды. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
93 lines
3.3 KiB
Docker
93 lines
3.3 KiB
Docker
# Dockerfile для обучения wake word модели openWakeWord
|
||
# Python 3.11 + torch 2.5 (последний совместимый с py3.11) + рабочие зависимости 2026
|
||
FROM python:3.11-slim
|
||
|
||
WORKDIR /app
|
||
|
||
# Системные зависимости (включая build-essential для webrtcvad)
|
||
RUN apt-get update && apt-get install -y \
|
||
git wget curl ffmpeg libsndfile1 \
|
||
build-essential python3-dev \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
# Клонируем openWakeWord и piper-sample-generator
|
||
RUN git clone https://github.com/dscripka/openWakeWord /openWakeWord
|
||
RUN git clone https://github.com/rhasspy/piper-sample-generator /piper-sample-generator
|
||
|
||
# Torch 2.5.0 — последний для Python 3.11, CPU версия (обучение не требует GPU)
|
||
RUN pip install --no-cache-dir \
|
||
torch==2.5.0 \
|
||
torchaudio==2.5.0 \
|
||
--index-url https://download.pytorch.org/whl/cpu
|
||
|
||
# Зависимости обучения с совместимыми версиями
|
||
RUN pip install --no-cache-dir \
|
||
mutagen==1.47.0 \
|
||
torchinfo==1.8.0 \
|
||
torchmetrics==1.2.0 \
|
||
speechbrain==1.0.3 \
|
||
audiomentations==0.43.1 \
|
||
torch-audiomentations==0.12.0 \
|
||
pronouncing==0.2.0 \
|
||
"datasets==2.20.0" \
|
||
"pyarrow==14.0.2" \
|
||
"fsspec==2023.12.2" \
|
||
acoustics==0.2.6 \
|
||
webrtcvad \
|
||
onnx \
|
||
onnxruntime \
|
||
onnx2tf \
|
||
pyyaml scipy scikit-learn tqdm
|
||
|
||
# TFLite конвертация через onnx2tf (замена мёртвого onnx_tf)
|
||
# Патчим train.py чтобы использовал onnx2tf вместо onnx_tf
|
||
RUN pip install --no-cache-dir \
|
||
tensorflow-cpu==2.21.0 \
|
||
tensorflow_probability==0.24.0
|
||
|
||
RUN pip install --no-cache-dir -e /openWakeWord
|
||
|
||
# Патч: заменяем onnx_tf на onnx2tf в train.py
|
||
RUN python - <<'EOF'
|
||
import re, pathlib
|
||
train_py = pathlib.Path("/openWakeWord/openwakeword/train.py")
|
||
text = train_py.read_text()
|
||
# Заменяем импорт onnx_tf
|
||
text = text.replace(
|
||
"import onnx_tf",
|
||
"import onnx2tf as onnx_tf_compat"
|
||
)
|
||
text = text.replace(
|
||
"from onnx_tf.backend import prepare",
|
||
"# onnx_tf replaced by onnx2tf"
|
||
)
|
||
# Заменяем вызов convert_onnx_to_tflite если он есть
|
||
text = re.sub(
|
||
r"onnx_tf\.backend\.prepare\(.*?\)",
|
||
"None # onnx2tf handles tflite conversion differently",
|
||
text, flags=re.DOTALL
|
||
)
|
||
train_py.write_text(text)
|
||
print("train.py patched OK")
|
||
EOF
|
||
|
||
# Устанавливаем piper-sample-generator
|
||
RUN pip install --no-cache-dir -e /piper-sample-generator 2>/dev/null || \
|
||
pip install --no-cache-dir piper-tts
|
||
|
||
# Скачиваем TTS модель LibriTTS-R medium (~66 MB) для генерации примеров
|
||
RUN mkdir -p /piper-sample-generator/models && \
|
||
wget -q --show-progress \
|
||
-O /piper-sample-generator/models/en_US-libritts_r-medium.onnx \
|
||
"https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/libritts_r/medium/en_US-libritts_r-medium.onnx" && \
|
||
wget -q \
|
||
-O /piper-sample-generator/models/en_US-libritts_r-medium.onnx.json \
|
||
"https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/libritts_r/medium/en_US-libritts_r-medium.onnx.json"
|
||
|
||
RUN mkdir -p /data /output /samples
|
||
|
||
COPY entrypoint.sh /entrypoint.sh
|
||
RUN chmod +x /entrypoint.sh
|
||
|
||
ENTRYPOINT ["/entrypoint.sh"]
|