From deac619d5b7050e20d9c984feac0b92a07247428 Mon Sep 17 00:00:00 2001 From: lihengzhong Date: Sun, 7 Jan 2024 14:19:21 +0800 Subject: [PATCH] add docker --- Dockerfile | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 7 ++++++ asrreal.py | 2 +- requirements.txt | 3 ++- 4 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..648ebd4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,55 @@ +# Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved. +# +# NVIDIA CORPORATION and its licensors retain all intellectual property +# and proprietary rights in and to this software, related documentation +# and any modifications thereto. Any use, reproduction, disclosure or +# distribution of this software and related documentation without an express +# license agreement from NVIDIA CORPORATION is strictly prohibited. + +ARG BASE_IMAGE=nvcr.io/nvidia/cuda:11.6.1-cudnn8-devel-ubuntu20.04 +FROM $BASE_IMAGE + +RUN apt-get update -yq --fix-missing \ + && DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \ + pkg-config \ + wget \ + cmake \ + curl \ + git \ + vim + +#ENV PYTHONDONTWRITEBYTECODE=1 +#ENV PYTHONUNBUFFERED=1 + +# nvidia-container-runtime +#ENV NVIDIA_VISIBLE_DEVICES all +#ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,graphics + +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh +RUN sh Miniconda3-latest-Linux-x86_64.sh -b -u -p ~/miniconda3 +RUN ~/miniconda3/bin/conda init +RUN source ~/.bashrc +RUN conda create -n nerfstream python=3.10 +RUN conda activate nerfstream + +RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ +# install depend +RUN conda install pytorch==1.12.1 torchvision==0.13.1 cudatoolkit=11.3 -c pytorch +Copy requirements.txt ./ +RUN pip install -r requirements.txt + +# additional libraries +RUN pip install "git+https://github.com/facebookresearch/pytorch3d.git" +RUN pip install tensorflow-gpu==2.8.0 + +RUN pip uninstall protobuf +RUN pip install protobuf==3.20.1 + +RUN conda install ffmpeg +Copy ../python_rtmpstream /python_rtmpstream +WORKDIR /python_rtmpstream/python +RUN pip install . + +Copy ../nerfstream /nerfstream +WORKDIR /nerfstream +CMD ["python3", "app.py"] diff --git a/README.md b/README.md index ed10296..c0b1d02 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,13 @@ python app.py 用浏览器打开http://serverip/echo.html,在文本框输入任意文字,提交。数字人播报该段文字 +### docker运行 +先运行srs和nginx +启动数字人 +``` +docker run --gpus all -it --network=host --rm registry.cn-hangzhou.aliyuncs.com/lipku/nerfstream:v1.2 +``` + ## Data flow ![](/assets/dataflow.png) diff --git a/asrreal.py b/asrreal.py index 0b062ad..eda6930 100644 --- a/asrreal.py +++ b/asrreal.py @@ -4,7 +4,7 @@ import torch import torch.nn.functional as F from transformers import AutoModelForCTC, AutoProcessor -import pyaudio +#import pyaudio import soundfile as sf import resampy diff --git a/requirements.txt b/requirements.txt index 68dee7f..12a5079 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,7 +18,7 @@ face_alignment python_speech_features numba resampy -pyaudio +#pyaudio soundfile einops configargparse @@ -30,3 +30,4 @@ transformers edge_tts flask flask_sockets +opencv-python-headless