diff --git a/voice_conversion/softvc/Dockerfile b/voice_conversion/softvc/Dockerfile index 83c52c1..89cbe71 100644 --- a/voice_conversion/softvc/Dockerfile +++ b/voice_conversion/softvc/Dockerfile @@ -1,5 +1,10 @@ -FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04 +# NB(bt, 2022-12-12): The version of containerized CUDA must match (or be less than?) that of the host system running this container. +# Juggling these dependencies, plus the underlying Ubuntu system (which controls Python versions), is tricky. +# Nvidia does not provide a CUDA 11.6 with Ubuntu 22.04, which mirrors my own desktop machine. Their CUDA 11.6 + Ubuntu 20.04 image has +# a stale Python (3.8), so we have to use the DeadSnakes PPA to install a more modern version. +# Gross. +FROM nvidia/cuda:11.6.2-runtime-ubuntu20.04 # See: https://github.com/opencontainers/image-spec/blob/master/annotations.md LABEL org.opencontainers.image.title='Storyteller ML: Voice Conversion' @@ -13,6 +18,13 @@ LABEL org.opencontainers.image.url='https://github.com/storytold/tts-core' ENV TZ=UTC RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +# Needed to install "future" release of Python 3.10 under Ubuntu 20.04, which only natively packages Python 3.8. +# We seem to be stuck on Ubuntu 22.04 because containerizd CUDA 11.6 is the only version we can run on my host machine, +# and Nvidia does not supply a (CUDA 11.6, Ubuntu 22.04) docker base image. +RUN apt-get update \ + && apt install software-properties-common -y \ + && add-apt-repository ppa:deadsnakes/ppa + RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \ curl \ @@ -27,10 +39,14 @@ RUN apt-get update \ --no-install-recommends # NB: Emit version for build debugging -RUN python3 --version +RUN python3.10 --version COPY requirements.txt . +# Get the correct PyTorch versions with the interactive version selector here: https://pytorch.org/ +# pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116 # For CUDA 11.6 +# pip install torch torchvision torchaudio # For CUDA 11.7 + # # NB: Forget about virtual environments inside the container. # # Also note the --extra-index-url, which is required for pytorch. # # The version persisted to 'requirements.txt' chokes without it. @@ -41,7 +57,7 @@ COPY requirements.txt . # NB: Install requirements in a virtual env too. # Also note the --extra-index-url, which is required for pytorch. # The version persisted to 'requirements.txt' chokes without it. -RUN python3 -m venv python +RUN python3.10 -m venv python RUN . python/bin/activate \ && pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116 \ && pip install -r requirements.txt \ diff --git a/voice_conversion/softvc/cli_inference.py b/voice_conversion/softvc/cli_inference.py index 552c519..06ab65a 100755 --- a/voice_conversion/softvc/cli_inference.py +++ b/voice_conversion/softvc/cli_inference.py @@ -13,6 +13,10 @@ import sys import torch import torchaudio +from gpu_utils import print_gpu_info + +print_gpu_info() + from collections import OrderedDict from time import time from torch.nn.modules.utils import consume_prefix_in_state_dict_if_present @@ -28,12 +32,9 @@ sys.path.append("./hifigan/") from hifigan.generator import HifiganGenerator from hifigan.generator import consume_prefix_in_state_dict_if_present -from gpu_utils import print_gpu_info # =========================================== -print_gpu_info() - parser = argparse.ArgumentParser() parser.add_argument('--acoustic_model_filename', type=str, required=True) parser.add_argument('--hifigan_model_filename', type=str, required=True) diff --git a/voice_conversion/softvc/requirements.txt b/voice_conversion/softvc/requirements.txt index 7f47736..01db990 100644 --- a/voice_conversion/softvc/requirements.txt +++ b/voice_conversion/softvc/requirements.txt @@ -42,9 +42,6 @@ soundfile==0.11.0 soupsieve==2.3.2.post1 stack-data==0.6.2 threadpoolctl==3.1.0 -torch==1.13.0+cu116 -torchaudio==0.13.0+cu116 -torchvision==0.14.0+cu116 tqdm==4.64.1 traitlets==5.6.0 typing_extensions==4.4.0