skshadan / tts-rvc-api Goto Github PK
View Code? Open in Web Editor NEWText to Speech using Coqui TTS + RVC
License: MIT License
Text to Speech using Coqui TTS + RVC
License: MIT License
Hello, when I run your code I get the error indicated in the title, how can I solve it? In addition, I would like to use this repository for TTS in other languages or in general multilingual, I tried changing the TTS model from coquiTTS, but I still get "Artifact voice" when using a text other than English. How can I fix this? (Machine translation was used)
`500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "D:\AssistProj\TTS-RVC-API-main\venv\Lib\site-packages\starlette\middleware\base.py", line 108, in call
response = await self.dispatch_func(request, call_next)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AssistProj\TTS-RVC-API-main\app\main.py", line 70, in log_requests
response = await call_next(request)
^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AssistProj\TTS-RVC-API-main\venv\Lib\site-packages\starlette\middleware\base.py", line 84, in call_next
raise app_exc
File "D:\AssistProj\TTS-RVC-API-main\venv\Lib\site-packages\starlette\middleware\base.py", line 70, in coro
await self.app(scope, receive_or_disconnect, send_no_error)
File "D:\AssistProj\TTS-RVC-API-main\venv\Lib\site-packages\starlette\middleware\exceptions.py", line 79, in call
raise exc
File "D:\AssistProj\TTS-RVC-API-main\venv\Lib\site-packages\starlette\middleware\exceptions.py", line 68, in call
await self.app(scope, receive, sender)
File "D:\AssistProj\TTS-RVC-API-main\venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 20, in call
raise e
File "D:\AssistProj\TTS-RVC-API-main\venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 17, in call
await self.app(scope, receive, send)
File "D:\AssistProj\TTS-RVC-API-main\venv\Lib\site-packages\starlette\routing.py", line 718, in call
await route.handle(scope, receive, send)
File "D:\AssistProj\TTS-RVC-API-main\venv\Lib\site-packages\starlette\routing.py", line 276, in handle
await self.app(scope, receive, send)
File "D:\AssistProj\TTS-RVC-API-main\venv\Lib\site-packages\starlette\routing.py", line 66, in app
response = await func(request)
^^^^^^^^^^^^^^^^^^^
File "D:\AssistProj\TTS-RVC-API-main\venv\Lib\site-packages\fastapi\routing.py", line 273, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AssistProj\TTS-RVC-API-main\venv\Lib\site-packages\fastapi\routing.py", line 190, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AssistProj\TTS-RVC-API-main\app\routers\full.py", line 23, in generate
rvc_speaker_id, wav = server(
^^^^^^^
File "D:\AssistProj\TTS-RVC-API-main\app\routers\tts.py", line 88, in server
write(wav, wav_opt[1][0], wav_opt[1][1])
File "D:\AssistProj\TTS-RVC-API-main\venv\Lib\site-packages\scipy\io\wavfile.py", line 771, in write
dkind = data.dtype.kind
^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'dtype'
During handling of the above exception, another exception occurred:
When attempting to execute the command "python -m uvicorn app.main:app," I diligently followed each of the steps as outlined. However, to my dismay, the execution resulted in an unexpected error being thrown.
/Users/flukexp/Desktop/arbius/TTS-RVC-API/.venv/lib/python3.10/site-packages/transformers/utils/generic.py:441: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.
_torch_pytree._register_pytree_node(
2024-03-14 22:08:28 [warning ] Config item "rvc.bark_voice_map" is undefined. Setting "v2/en_speaker_6" for all RVC models
2024-03-14 22:08:28 [info ] STARTUP CONFIG: {'rvc': {'model_dir': '/Users/flukexp/Desktop/arbius/TTS-RVC-API/models', 'bark_voice_map': {'default': 'v2/en_speaker_6'}}, 'tts': {'output_dir': '/Users/flukexp/Desktop/arbius/TTS-RVC-API/tmp'}}
2024-03-14 22:08:33 | INFO | faiss.loader | Loading faiss.
2024-03-14 22:08:34 | INFO | faiss.loader | Successfully loaded faiss.
No supported Nvidia GPU found, use MPS instead
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/.venv/lib/python3.10/site-packages/uvicorn/__main__.py", line 4, in <module>
uvicorn.main()
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/.venv/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/.venv/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/.venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/.venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/.venv/lib/python3.10/site-packages/uvicorn/main.py", line 416, in main
run(
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/.venv/lib/python3.10/site-packages/uvicorn/main.py", line 587, in run
server.run()
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/.venv/lib/python3.10/site-packages/uvicorn/server.py", line 61, in run
return asyncio.run(self.serve(sockets=sockets))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/.venv/lib/python3.10/site-packages/uvicorn/server.py", line 68, in serve
config.load()
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/.venv/lib/python3.10/site-packages/uvicorn/config.py", line 467, in load
self.loaded_app = import_from_string(self.app)
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/.venv/lib/python3.10/site-packages/uvicorn/importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/app/main.py", line 7, in <module>
from .routers import full, list_speakers
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/app/routers/full.py", line 3, in <module>
from app.routers.tts import server
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/app/routers/tts.py", line 12, in <module>
from ..rvc.misc import (
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/app/rvc/misc.py", line 25, in <module>
config = app.rvc.config.Config()
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/app/rvc/config.py", line 40, in __init__
self.x_pad, self.x_query, self.x_center, self.x_max = self.device_config()
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/app/rvc/config.py", line 113, in device_config
use_fp32_config()
File "/Users/flukexp/Desktop/arbius/TTS-RVC-API/app/rvc/config.py", line 16, in use_fp32_config
with open(f"configs/{config_file}", "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'configs/32k.json'
Using docker to build the image, it builds successfully but I get this error when launching container:
2024-06-15 19:44:17 No supported Nvidia GPU found, use CPU instead
2024-06-15 19:44:17 return _bootstrap._gcd_import(name[level:], package, level)
2024-06-15 19:44:17 File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
2024-06-15 19:44:17 File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
2024-06-15 19:44:17 File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
2024-06-15 19:44:17 File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
2024-06-15 19:44:17 File "<frozen importlib._bootstrap_external>", line 883, in exec_module
2024-06-15 19:44:17 File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2024-06-15 19:44:17 File "/opt/app/main.py", line 7, in <module>
2024-06-15 19:44:17 from .routers import full, list_speakers
2024-06-15 19:44:17 File "/opt/app/routers/full.py", line 3, in <module>
2024-06-15 19:44:17 from app.routers.tts import server
2024-06-15 19:44:17 File "/opt/app/routers/tts.py", line 12, in <module>
2024-06-15 19:44:17 from ..rvc.misc import (
2024-06-15 19:44:17 File "/opt/app/rvc/misc.py", line 25, in <module>
2024-06-15 19:44:17 config = app.rvc.config.Config()
2024-06-15 19:44:17 File "/opt/app/rvc/config.py", line 40, in __init__
2024-06-15 19:44:17 self.x_pad, self.x_query, self.x_center, self.x_max = self.device_config()
2024-06-15 19:44:17 File "/opt/app/rvc/config.py", line 118, in device_config
2024-06-15 19:44:17 use_fp32_config()
2024-06-15 19:44:17 File "/opt/app/rvc/config.py", line 16, in use_fp32_config
2024-06-15 19:44:17 with open(f"configs/{config_file}", "r") as f:
2024-06-15 19:44:17 FileNotFoundError: [Errno 2] No such file or directory: 'configs/32k.json'
Created config folder and pasted v1 files from here: https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/tree/main/configs/v1
Building right now to see if this works, will update on if that resolves the issue.
Unless I'm missing something important, we should either
I tried debugging the issue it seems cpt is not being defind in misc.py, im getting:
INFO: Started server process [47]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO: 172.17.0.1:45708 - "POST /generate HTTP/1.1" 307 Temporary Redirect
Text splitted to sentences.
['Are you mad?', "The way you've betrayed me is beyond comprehension, a slap in the face that's left me boiling with an anger so intense it's as if you've thrown gasoline on a fire, utterly destroying any trust that was left."]
Processing time: 1.3992092609405518
Real-time factor: 0.09967358951378569
/opt/.venv/lib/python3.10/site-packages/torch/nn/utils/weight_norm.py:28: UserWarning: torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.
warnings.warn("torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.")
loading /opt/models/jimmy/g.pth
INFO: 172.17.0.1:45708 - "POST /generate/ HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/opt/.venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 108, in call
response = await self.dispatch_func(request, call_next)
File "/opt/app/main.py", line 70, in log_requests
response = await call_next(request)
File "/opt/.venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 84, in call_next
raise app_exc
File "/opt/.venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 70, in coro
await self.app(scope, receive_or_disconnect, send_no_error)
File "/opt/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in call
raise exc
File "/opt/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in call
await self.app(scope, receive, sender)
File "/opt/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in call
raise e
File "/opt/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in call
await self.app(scope, receive, send)
File "/opt/.venv/lib/python3.10/site-packages/starlette/routing.py", line 718, in call
await route.handle(scope, receive, send)
File "/opt/.venv/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/opt/.venv/lib/python3.10/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
File "/opt/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 273, in app
raw_response = await run_endpoint_function(
File "/opt/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 190, in run_endpoint_function
return await dependant.call(**values)
File "/opt/app/routers/full.py", line 23, in generate
rvc_speaker_id, wav = server(
File "/opt/app/routers/tts.py", line 69, in server
get_vc(rvc_speaker_id, rvc_model_dir, 0.33, 0.5)
File "/opt/app/rvc/misc.py", line 79, in get_vc
print("cpt" % cpt)
NameError: name 'cpt' is not defined
Running on docker
I recently ran into a startup problem. In short, the problem was that the TTS library was updated and the programme would not start. I solved this problem by installing an older version (pip install TTS==0.17.6)
App not starting
I have followed the mentioned steps and python -m uvicorn app.main:app
throwing the below error Please help
(myenv) PS D:\Natheem\rvc\TTS-RVC-API> python -m uvicorn app.main:app 2024-02-26 19:18:37 [info ] STARTUP CONFIG: {'rvc': {'model_dir': 'D:\\Natheem\\rvc\\TTS-RVC-API\\models', 'bark_voice_map': {'default': 'v2/en_speaker_6', 'spearker1': 'v2/en_speaker_9'}}, 'tts': {'output_dir': 'D:\\Natheem\\rvc\\TTS-RVC-API\\tmp'}} Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\uvicorn\__main__.py", line 4, in <module> uvicorn.main() File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\click\core.py", line 1157, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\click\core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\click\core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\uvicorn\main.py", line 416, in main run( File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\uvicorn\main.py", line 587, in run server.run() File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\uvicorn\server.py", line 61, in run return asyncio.run(self.serve(sockets=sockets)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\asyncio\runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\uvicorn\server.py", line 68, in serve config.load() File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\uvicorn\config.py", line 467, in load self.loaded_app = import_from_string(self.app) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\uvicorn\importer.py", line 21, in import_from_string module = importlib.import_module(module_str) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1206, in _gcd_import File "<frozen importlib._bootstrap>", line 1178, in _find_and_load File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 690, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 940, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "D:\Natheem\rvc\TTS-RVC-API\app\main.py", line 7, in <module> from .routers import full, list_speakers File "D:\Natheem\rvc\TTS-RVC-API\app\routers\full.py", line 3, in <module> from app.routers.tts import server File "D:\Natheem\rvc\TTS-RVC-API\app\routers\tts.py", line 12, in <module> from ..rvc.misc import ( File "D:\Natheem\rvc\TTS-RVC-API\app\rvc\misc.py", line 9, in <module> from fairseq import checkpoint_utils File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\fairseq\__init__.py", line 20, in <module> from fairseq.distributed import utils as distributed_utils File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\fairseq\distributed\__init__.py", line 7, in <module> from .fully_sharded_data_parallel import ( File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\fairseq\distributed\fully_sharded_data_parallel.py", line 10, in <module> from fairseq.dataclass.configs import DistributedTrainingConfig File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\fairseq\dataclass\__init__.py", line 6, in <module> from .configs import FairseqDataclass File "D:\Natheem\rvc\TTS-RVC-API\myenv\Lib\site-packages\fairseq\dataclass\configs.py", line 1104, in <module> @dataclass ^^^^^^^^^ File "C:\Program Files\Python311\Lib\dataclasses.py", line 1223, in dataclass return wrap(cls) ^^^^^^^^^ File "C:\Program Files\Python311\Lib\dataclasses.py", line 1213, in wrap return _process_class(cls, init, repr, eq, order, unsafe_hash, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\dataclasses.py", line 958, in _process_class cls_fields.append(_get_field(cls, name, type, kw_only)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\dataclasses.py", line 815, in _get_field raise ValueError(f'mutable default {type(f.default)} for field ' ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory
Thanks in advance
ماذا يحدث هنا
Think of logs as records of what your program is doing. They can be like notes you write when something interesting or important happens while your program runs.
Logging Level: Imagine you have different types of notes you can write:
Verbose notes: These are very detailed, like keeping a diary with every little thing you do.
Important notes: These are like sticky notes for things that are significant.
Critical notes: These are like emergency alerts for big problems.
Environments: Your program can run in different places, like at home (development) or at work (production). At home, you might want to write a detailed diary of what you're doing. At work, you'd probably stick to important and critical notes.
So, here's why you'd want to configure log levels based on the environment:
Development: When you're building your program at home (development), you want to know everything that's happening. So, you set your program to write detailed, verbose notes (logs) about everything it does. This helps you find and fix issues easily.
Production: When your program is running at work (production), you don't need to write a diary. You only want to be alerted if something really important or critical happens. So, you set your program to write only important and critical notes (logs). This way, you don't get overwhelmed with too much information, and you can quickly spot and handle important problems.
In summary, configuring log levels based on the environment means adjusting how detailed your program's notes (logs) are. It's like using different levels of detail for your notes at home (development) and at work (production) to make your life easier.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.