2024-07-18 09:17:19 [INFO] [BERT-VITS2] text_prompt:Happy [in views.voice_bert_vits2_api:476]
2024-07-18 09:17:19 [ERROR] Exception on /voice/bert-vits2 [POST] [in app.log_exception:1744]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 2528, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.10/site-packages/flask_cors/extension.py", line 178, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/app/tts_app/voice_api/auth.py", line 10, in check_api_key
return func(*args, **kwargs)
File "/app/tts_app/voice_api/views.py", line 543, in voice_bert_vits2_api
audio = tts_manager.bert_vits2_infer(state)
File "/app/manager/TTSManager.py", line 407, in bert_vits2_infer
audio = infer_func(**state)
File "/app/bert_vits2/bert_vits2.py", line 342, in infer
zh_bert, ja_bert, en_bert, phones, tones, lang_ids = self.get_text(text, lang, self.hps_ms, style_text,
File "/app/bert_vits2/bert_vits2.py", line 249, in get_text
bert = self.model_handler.get_bert_feature(norm_text, word2ph, bert_feature_lang_str,
File "/app/manager/model_handler.py", line 274, in get_bert_feature
bert_feature = self.lang_bert_func_map[language](norm_text, word2ph, tokenizer, model, self.device,
File "/app/bert_vits2/text/chinese_bert_extra.py", line 11, in get_bert_feature
inputs[i] = inputs[i].to(device)
File "/usr/local/lib/python3.10/site-packages/torch/cuda/__init__.py", line 288, in _lazy_init
raise RuntimeError(
RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method
运行环境
问题描述
配置文件中system.device设为cuda后会出现以下报错
可能跟 gunicorn有关