Artrajz commited on
Commit
7fcd6e3
·
1 Parent(s): 2919150

Update: change gunicorn workers, fix absolute path, add GPU docker version

Browse files
.github/workflows/docker-latest.yml CHANGED
@@ -30,8 +30,20 @@ jobs:
30
  uses: docker/build-push-action@v4
31
  with:
32
  context: .
 
33
  push: true
34
  platforms: 'linux/amd64,linux/arm64'
35
- tags: ${{ vars.DOCKER_REPO_NAME }}:latest
 
 
 
 
 
 
 
 
 
 
 
36
  cache-from: type=gha
37
  cache-to: type=gha,mode=max
 
30
  uses: docker/build-push-action@v4
31
  with:
32
  context: .
33
+ file: ./Dockerfile
34
  push: true
35
  platforms: 'linux/amd64,linux/arm64'
36
+ tags: artrajz/vits-simple-api:latest
37
+ cache-from: type=gha
38
+ cache-to: type=gha,mode=max
39
+ -
40
+ name: Build and push
41
+ uses: docker/build-push-action@v4
42
+ with:
43
+ context: .
44
+ file: ./Dockerfile_GPU
45
+ push: true
46
+ platforms: 'linux/amd64,linux/arm64'
47
+ tags: artrajz/vits-simple-api-gpu:latest
48
  cache-from: type=gha
49
  cache-to: type=gha,mode=max
Dockerfile_GPU ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10.11-slim-bullseye
2
+
3
+ RUN mkdir -p /app
4
+ WORKDIR /app
5
+
6
+ ENV DEBIAN_FRONTEND=noninteractive
7
+
8
+ RUN apt-get update && \
9
+ apt install build-essential -yq && \
10
+ apt install espeak-ng -yq && \
11
+ apt install cmake -yq && \
12
+ apt install -y wget -yq && \
13
+ apt-get clean && \
14
+ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
15
+ rm -rf /var/lib/apt/lists/*
16
+
17
+ RUN pip install MarkupSafe==2.1.2 numpy==1.23.3 cython six==1.16.0
18
+
19
+ RUN wget https://raw.githubusercontent.com/Artrajz/archived/main/openjtalk/openjtalk-0.3.0.dev2.tar.gz && \
20
+ tar -zxvf openjtalk-0.3.0.dev2.tar.gz && \
21
+ cd openjtalk-0.3.0.dev2 && \
22
+ rm -rf ./pyopenjtalk/open_jtalk_dic_utf_8-1.11 && \
23
+ python setup.py install && \
24
+ cd ../ && \
25
+ rm -f openjtalk-0.3.0.dev2.tar.gz && \
26
+ rm -rf openjtalk-0.3.0.dev2
27
+
28
+ RUN pip install torch --index-url https://download.pytorch.org/whl/cu117
29
+
30
+ COPY requirements.txt /app
31
+ RUN pip install -r requirements.txt
32
+
33
+ RUN pip install gunicorn
34
+
35
+ COPY . /app
36
+
37
+ EXPOSE 23456
38
+
39
+ CMD ["gunicorn", "-c", "gunicorn_config.py", "app:app"]
config.py CHANGED
@@ -12,7 +12,7 @@ DEBUG = False
12
  PORT = 23456
13
 
14
  # Absolute path of vits-simple-api
15
- ABS_PATH = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])))
16
 
17
  # Upload path
18
  UPLOAD_FOLDER = ABS_PATH + "/upload"
 
12
  PORT = 23456
13
 
14
  # Absolute path of vits-simple-api
15
+ ABS_PATH = os.path.dirname(os.path.realpath(__file__))
16
 
17
  # Upload path
18
  UPLOAD_FOLDER = ABS_PATH + "/upload"
gunicorn_config.py CHANGED
@@ -1,4 +1,4 @@
1
  import multiprocessing
2
 
3
  bind = "0.0.0.0:23456"
4
- workers = multiprocessing.cpu_count() * 2 + 1
 
1
  import multiprocessing
2
 
3
  bind = "0.0.0.0:23456"
4
+ workers = multiprocessing.cpu_count()
text/mandarin.py CHANGED
@@ -1,5 +1,4 @@
1
- import os
2
- import sys
3
  import re
4
  from pypinyin import lazy_pinyin, BOPOMOFO
5
  import jieba
@@ -7,7 +6,7 @@ import cn2an
7
  import logging
8
 
9
  logging.getLogger('jieba').setLevel(logging.WARNING)
10
- jieba.set_dictionary(os.path.dirname(os.path.realpath(sys.argv[0])) + '/jieba/dict.txt')
11
  jieba.initialize()
12
 
13
  # List of (Latin alphabet, bopomofo) pairs:
 
1
+ import config
 
2
  import re
3
  from pypinyin import lazy_pinyin, BOPOMOFO
4
  import jieba
 
6
  import logging
7
 
8
  logging.getLogger('jieba').setLevel(logging.WARNING)
9
+ jieba.set_dictionary(config.ABS_PATH + '/jieba/dict.txt')
10
  jieba.initialize()
11
 
12
  # List of (Latin alphabet, bopomofo) pairs: