descriptinc / audiotools

Object-oriented handling of audio data, with GPU-powered augmentations, and more.
https://descriptinc.github.io/audiotools/
MIT License
233 stars 39 forks source link

ViSQOL does not work! #93

Closed listener17 closed 1 year ago

listener17 commented 1 year ago

I've

>>> audiotools.__version__
'0.7.1'

PESQ works!

metrics.quality.pesq(signal, signal, 'wb')
tensor([4.6439], dtype=torch.float64)

But, ViSQOL does not work!

>>> metrics.quality.visqol(signal, signal, 'audio')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/miniconda3/envs/metrics/lib/python3.9/site-packages/audiotools/metrics/quality.py", line 126, in visqol
    from visqol import visqol_lib_py
ModuleNotFoundError: No module named 'visqol'

From where should I get the module?

pseeth commented 1 year ago

Ah, you need to build ViSQOL into a container or install it on your machine via bazel. Here are some instructions from our Dockerfile which enable this:

###################################
FROM nvidia/cuda:11.8.0-base-ubuntu20.04 as visqol

# Set env, workdir and add install scripts/specs
ENV HOME /home
WORKDIR /home

ENV DEBIAN_FRONTEND="noninteractive" \
    PYTHON_BIN_PATH=/usr/bin/python3
RUN apt-get update && apt-get install -y --no-install-recommends \
    apt-transport-https \
    curl \
    git \
    gnupg \
    libboost-all-dev \
    python3 \
    python3-pip && \
    apt-get clean && \
    apt-get autoclean && \
    apt-get autoremove && \
    rm -rf /var/lib/apt/lists/* && \
    curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg && \
    mv bazel-archive-keyring.gpg /usr/share/keyrings && \
    echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list && \
    apt-get update && apt-get install -y --no-install-recommends bazel bazel-5.3.2 && \
    pip install numpy absl-py

RUN pip install git+https://github.com/google/visqol.git@2dc96a848bece3d43797b64f85b1d76596660757
###################################

This installs ViSQOL (which we made pip installable in this PR).