mirror of
https://github.com/storytold/storyteller-ml.git
synced 2026-10-19 07:54:56 +00:00
Fix docker image to run on my system's host CUDA version
This commit is contained in:
@@ -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
|
# See: https://github.com/opencontainers/image-spec/blob/master/annotations.md
|
||||||
LABEL org.opencontainers.image.title='Storyteller ML: Voice Conversion'
|
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
|
ENV TZ=UTC
|
||||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
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 \
|
RUN apt-get update \
|
||||||
&& DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \
|
&& DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \
|
||||||
curl \
|
curl \
|
||||||
@@ -27,10 +39,14 @@ RUN apt-get update \
|
|||||||
--no-install-recommends
|
--no-install-recommends
|
||||||
|
|
||||||
# NB: Emit version for build debugging
|
# NB: Emit version for build debugging
|
||||||
RUN python3 --version
|
RUN python3.10 --version
|
||||||
|
|
||||||
COPY requirements.txt .
|
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.
|
# # NB: Forget about virtual environments inside the container.
|
||||||
# # Also note the --extra-index-url, which is required for pytorch.
|
# # Also note the --extra-index-url, which is required for pytorch.
|
||||||
# # The version persisted to 'requirements.txt' chokes without it.
|
# # The version persisted to 'requirements.txt' chokes without it.
|
||||||
@@ -41,7 +57,7 @@ COPY requirements.txt .
|
|||||||
# NB: Install requirements in a virtual env too.
|
# NB: Install requirements in a virtual env too.
|
||||||
# Also note the --extra-index-url, which is required for pytorch.
|
# Also note the --extra-index-url, which is required for pytorch.
|
||||||
# The version persisted to 'requirements.txt' chokes without it.
|
# The version persisted to 'requirements.txt' chokes without it.
|
||||||
RUN python3 -m venv python
|
RUN python3.10 -m venv python
|
||||||
RUN . python/bin/activate \
|
RUN . python/bin/activate \
|
||||||
&& pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116 \
|
&& pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116 \
|
||||||
&& pip install -r requirements.txt \
|
&& pip install -r requirements.txt \
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ import sys
|
|||||||
import torch
|
import torch
|
||||||
import torchaudio
|
import torchaudio
|
||||||
|
|
||||||
|
from gpu_utils import print_gpu_info
|
||||||
|
|
||||||
|
print_gpu_info()
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from time import time
|
from time import time
|
||||||
from torch.nn.modules.utils import consume_prefix_in_state_dict_if_present
|
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 HifiganGenerator
|
||||||
from hifigan.generator import consume_prefix_in_state_dict_if_present
|
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 = argparse.ArgumentParser()
|
||||||
parser.add_argument('--acoustic_model_filename', type=str, required=True)
|
parser.add_argument('--acoustic_model_filename', type=str, required=True)
|
||||||
parser.add_argument('--hifigan_model_filename', type=str, required=True)
|
parser.add_argument('--hifigan_model_filename', type=str, required=True)
|
||||||
|
|||||||
@@ -42,9 +42,6 @@ soundfile==0.11.0
|
|||||||
soupsieve==2.3.2.post1
|
soupsieve==2.3.2.post1
|
||||||
stack-data==0.6.2
|
stack-data==0.6.2
|
||||||
threadpoolctl==3.1.0
|
threadpoolctl==3.1.0
|
||||||
torch==1.13.0+cu116
|
|
||||||
torchaudio==0.13.0+cu116
|
|
||||||
torchvision==0.14.0+cu116
|
|
||||||
tqdm==4.64.1
|
tqdm==4.64.1
|
||||||
traitlets==5.6.0
|
traitlets==5.6.0
|
||||||
typing_extensions==4.4.0
|
typing_extensions==4.4.0
|
||||||
|
|||||||
Reference in New Issue
Block a user