load some tt2 models on startup - todo(kasisnu): fix hardcoding

This commit is contained in:
Kasisnu
2024-05-01 21:10:46 +05:30
parent 13383ed524
commit 33be84a1ee
3 changed files with 67 additions and 0 deletions
@@ -153,3 +153,4 @@ COPY ./container_start_tts_server.sh /
# TTS model code:
COPY ./ ./models/tts
COPY popular_weights.txt /model_cache_prewarm_list.txt
@@ -0,0 +1,50 @@
/tmp/persistent/tts/synthesizer_models/weight_0f762jdzgsy1dhpb86qxy4ssm
/tmp/persistent/tts/synthesizer_models/weight_sfyjyr67ag1647xs0r7gmvkks
/tmp/persistent/tts/synthesizer_models/weight_ahxbf2104ngsgyegncaefyy6j
/tmp/persistent/tts/synthesizer_models/weight_kwmxssf6k6ha92h3b55mh3w9q
/tmp/persistent/tts/synthesizer_models/weight_hehgvegadf08mfp5rzd69dmh4
/tmp/persistent/tts/synthesizer_models/weight_34vt3stah9xyts72zrya85vc9
/tmp/persistent/tts/synthesizer_models/weight_rhfg4chgrp42bnha8kqfrtmcq
/tmp/persistent/tts/synthesizer_models/weight_b8rncypy7gw6nb0wthnwe2kk4
/tmp/persistent/tts/synthesizer_models/weight_h8ebh6fyjyrr1vsjregw6yz8y
/tmp/persistent/tts/synthesizer_models/weight_hz7g8f1j4psrsw2sv67e4y61q
/tmp/persistent/tts/synthesizer_models/weight_txvtzmcd7jw0rg192284r1g3w
/tmp/persistent/tts/synthesizer_models/weight_0cg1294gaf52c7rh0vz7a2ger
/tmp/persistent/tts/synthesizer_models/weight_mbcr352wfb1eq76tpy3ef3kx1
/tmp/persistent/tts/synthesizer_models/weight_83bv8pnva9vewht8zpye1x060
/tmp/persistent/tts/synthesizer_models/weight_0bsxzrwp6p77t67s8dcn607wf
/tmp/persistent/tts/synthesizer_models/weight_t7a4br08b76btnnwkb32tsh7q
/tmp/persistent/tts/synthesizer_models/weight_fte9rq3em7vv9rqex0f8cvwdx
/tmp/persistent/tts/synthesizer_models/weight_tq6pwerrbr4mvbjmtyhbsqe6t
/tmp/persistent/tts/synthesizer_models/weight_f4av238kbadw9h258v1cq1mxw
/tmp/persistent/tts/synthesizer_models/weight_81waz0re2yzgw2fnmj0ah94zc
/tmp/persistent/tts/synthesizer_models/weight_62nh7prayvcnevbg2hq5qp1r8
/tmp/persistent/tts/synthesizer_models/weight_3dnyrwny7d4585pcfjdrghxsq
/tmp/persistent/tts/synthesizer_models/weight_kksrk14y802808as3d6mphedm
/tmp/persistent/tts/synthesizer_models/weight_47hcjvnyfff60g4vty4thp400
/tmp/persistent/tts/synthesizer_models/weight_r95f5pvvstgps0ychfqrzpfs3
/tmp/persistent/tts/synthesizer_models/weight_jzs5qmvtbvk934680ghfp48cf
/tmp/persistent/tts/synthesizer_models/weight_pttvmv1z6ppddypx37z1e8ptj
/tmp/persistent/tts/synthesizer_models/weight_cg6heneq0rmkas3qj7ccz0t0r
/tmp/persistent/tts/synthesizer_models/weight_7nkrya6jq2gdmhvzvhwe6565a
/tmp/persistent/tts/synthesizer_models/weight_ren3ng1bvpktsvg58gcrv2s52
/tmp/persistent/tts/synthesizer_models/weight_79nve5ntc03rd2k5532je1rf6
/tmp/persistent/tts/synthesizer_models/weight_79mn6535kkfey17bgpg9xty23
/tmp/persistent/tts/synthesizer_models/weight_31ewdsvev9bttgb4eg7zy7mj5
/tmp/persistent/tts/synthesizer_models/weight_x6r5w2tsxgcrrsgweva6dkrqj
/tmp/persistent/tts/synthesizer_models/weight_qh9r4xthejrcngkqcyzmz354e
/tmp/persistent/tts/synthesizer_models/weight_s0zjjkmht28dp4gm83e6xvjdk
/tmp/persistent/tts/synthesizer_models/weight_6y87xbjmqjxbf49ad880590kw
/tmp/persistent/tts/synthesizer_models/weight_2dymgf6pcrfr6p1twmc4pnpf9
/tmp/persistent/tts/synthesizer_models/weight_h9zt7s7sn070hqwdx160gj899
/tmp/persistent/tts/synthesizer_models/weight_abe03ym9bztnzvx462kkc3fak
/tmp/persistent/tts/synthesizer_models/weight_jephx9sjmwzc7t4x29jsw88jg
/tmp/persistent/tts/synthesizer_models/weight_m7ns3pee2hze7r5hs3c1c5ew3
/tmp/persistent/tts/synthesizer_models/weight_bc0tjv6fs7c1ccrtw8mbwxay5
/tmp/persistent/tts/synthesizer_models/weight_1f7xnr358bkrhtx8y0v9cbfr6
/tmp/persistent/tts/synthesizer_models/weight_s4bmmamst4a7ca2pg7tc52zwx
/tmp/persistent/tts/synthesizer_models/weight_xn5k6j10w4aa10kazzkmcweer
/tmp/persistent/tts/synthesizer_models/weight_828jq9waqx5g9dzp7gr6a2a1p
/tmp/persistent/tts/synthesizer_models/weight_1e5qem1g6t813qzk0p001r6sv
/tmp/persistent/tts/synthesizer_models/weight_avrvkn2rjyd76a8btdycdghj0
/tmp/persistent/tts/synthesizer_models/weight_ms1kzt5m09cfw1yn666cxhy88
@@ -18,6 +18,7 @@ import tensorflow as tf
import subprocess
import tempfile
import json
import time
from falcon_multipart.middleware import MultipartMiddleware
#from model import CycleGAN
@@ -289,10 +290,25 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument('--port', type=int, default=8000)
parser.add_argument('--model-cache-limit', type=int, default=100)
parser.add_argument('--model-cache-prewarm-list-file', type=str, default='/model_cache_prewarm_list.txt')
args = parser.parse_args()
pipeline.set_cache_limit(args.model_cache_limit)
# read prewarm list, _before_ starting the server
# this happens before the health check, so we don't risk
# starting the server and then mutating the cache state
try:
if os.path.exists(args.model_cache_prewarm_list_file):
with open(args.model_cache_prewarm_list_file, 'r') as f:
prewarm_list = f.read().splitlines()
for model_path in prewarm_list:
if os.path.exists(model_path):
pipeline.maybe_load_tacotron_model_to_cache(model_path)
except Exception as e:
LOGGER.error(f"Failed to prewarm model cache: {e}")
api = falcon.API(middleware=[MultipartMiddleware()])
api.add_route('/', IndexHandler())
api.add_route('/_status', StatusHandler())