4.0版本python flask_api.py报错
Opened this issue · 1 comments
ERROR:flask_api:Exception on /voiceChangeModel [POST]
Traceback (most recent call last):
File "D:\Anaconda\lib\site-packages\flask\app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "D:\Anaconda\lib\site-packages\flask\app.py", line 1525, in full_dispatch_request
rv = self.handle_user_exception(e)
File "D:\Anaconda\lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "D:\Anaconda\lib\site-packages\flask\app.py", line 1523, in full_dispatch_request
rv = self.dispatch_request()
File "D:\Anaconda\lib\site-packages\flask\app.py", line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "D:\sovits\so-vits-svc-4.0\flask_api.py", line 33, in voice_change_model
out_audio, out_sr = svc_model.infer(speaker_id, f_pitch_change, input_wav_path)
File "D:\sovits\so-vits-svc-4.0\inference\infer_tool.py", line 170, in infer
speaker_id = self.spk2id[speaker]
File "D:\sovits\so-vits-svc-4.0\utils.py", line 492, in __getitem__
return getattr(self, key)
TypeError: getattr(): attribute name must be string
请问是还没适配吗?
我也遇到了
将utils.py第492行改为
return getattr(self, str(key))
后出现了新的报错
ERROR:flask_api:Exception on /voiceChangeModel [POST]
Traceback (most recent call last):
File "E:\so-vits-svc\venv\lib\site-packages\flask\app.py", line 2528, in wsgi_app
response = self.full_dispatch_request()
File "E:\so-vits-svc\venv\lib\site-packages\flask\app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
File "E:\so-vits-svc\venv\lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "E:\so-vits-svc\venv\lib\site-packages\flask\app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "E:\so-vits-svc\venv\lib\site-packages\flask\app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File ".\flask_api.py", line 33, in voice_change_model
out_audio, out_sr = svc_model.infer(speaker_id, f_pitch_change, input_wav_path)
File "E:\so-vits-svc\inference\infer_tool.py", line 170, in infer
speaker_id = self.spk2id[speaker]
File "E:\so-vits-svc\utils.py", line 492, in getitem
return getattr(self, str(key))
AttributeError: 'HParams' object has no attribute '0'
INFO:werkzeug:127.0.0.1 - - [05/Mar/2023 13:59:24] "POST /voiceChangeModel HTTP/1.1" 500 -
不知道怎么解决