# Automatic speech-quality scoring (CPU), all from existing libraries: # - DNSMOS P.835 (SIG/BAK/OVRL) + P.808: torchmetrics (official Microsoft ONNX models) # - UTMOS22 strong (naturalness MOS predictor): tarepan/SpeechMOS via torch.hub # - Vocos 24 kHz pretrained vocoder (re-voicing test): vocos # Neither MOS model is trained on Danish: use them for relative comparisons between systems. FROM python:3.12-slim RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates libsndfile1 \ && rm -rf /var/lib/apt/lists/* RUN pip install --no-cache-dir torch==2.8.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cpu \ && pip install --no-cache-dir "torchmetrics>=1.5,<2" onnxruntime==1.23.2 librosa==0.11.0 \ soundfile==0.14.0 requests "numpy<2.4" vocos==0.1.0 # Model files are fetched at build time into a read-only HOME so containers run offline. ENV HOME=/opt/quality/home TORCH_HOME=/opt/quality/torch HF_HOME=/opt/quality/hf \ NUMBA_CACHE_DIR=/tmp/numba PYTHONUNBUFFERED=1 RUN python -c "import torch; from torchmetrics.functional.audio.dnsmos import deep_noise_suppression_mean_opinion_score as d; print(d(torch.zeros(16000), 16000, False))" \ && python -c "import torch; torch.hub.load('tarepan/SpeechMOS:v1.2.0', 'utmos22_strong', trust_repo=True)" \ && python -c "from vocos import Vocos; Vocos.from_pretrained('charactr/vocos-mel-24khz')" \ && rm -rf /tmp/numba \ && chmod -R a+rX /opt/quality WORKDIR /work