| FROM python:3.10
|
|
|
|
|
| USER root
|
| RUN apt-get update && apt-get install -y --no-install-recommends \
|
| cmake build-essential libasound2-dev libsndfile1 git \
|
| mecab libmecab-dev mecab-ipadic-utf8 \
|
| && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
| RUN useradd -m -u 1000 user
|
| USER user
|
| ENV HOME=/home/user \
|
| PATH=/home/user/.local/bin:$PATH
|
| WORKDIR $HOME/app
|
|
|
|
|
| RUN pip install --no-cache-dir --upgrade pip
|
| RUN pip install --no-cache-dir "setuptools<70.0.0" "Cython<3.0" wheel "numpy<2.0" huggingface_hub
|
|
|
|
|
| RUN pip install --no-cache-dir pyopenjtalk==0.3.0 --no-build-isolation
|
|
|
|
|
| COPY --chown=user . $HOME/app
|
|
|
|
|
|
|
| RUN find style_bert_vits2 -name "*.py" -exec sed -i 's/socket.gethostname()/"127.0.0.1"/g' {} + || true
|
|
|
| RUN sed -i 's/sys.exit(1)/pass/g' server_editor.py || true
|
|
|
|
|
| RUN mkdir -p model_assets
|
|
|
|
|
| RUN pip install --no-cache-dir "numpy<2.0" && \
|
| pip install --no-cache-dir -r requirements.txt && \
|
| pip install --no-cache-dir "numpy<2.0"
|
|
|
|
|
| EXPOSE 7860
|
|
|
|
|
| CMD python -c "import pyopenjtalk; pyopenjtalk._extract_dic()" && \
|
| python -c 'import os; from huggingface_hub import hf_hub_download; \
|
| bert_dir = "bert/deberta-v2-large-japanese-char-wwm"; \
|
| os.makedirs(bert_dir, exist_ok=True); \
|
| files = ["config.json", "pytorch_model.bin", "tokenizer_config.json", "vocab.txt"]; \
|
| [hf_hub_download(repo_id="ku-nlp/deberta-v2-large-japanese-char-wwm", filename=f, local_dir=bert_dir, local_dir_use_symlinks=False) for f in files if not os.path.exists(os.path.join(bert_dir, f))]' && \
|
| python server_editor.py --line_length 50 --line_count 3 --skip_static_files --skip_default_models --port 7860 |