erew123 / alltalk_tts

AllTalk is based on the Coqui TTS engine, similar to the Coqui_tts extension for Text generation webUI, however supports a variety of advanced features, such as a settings page, low VRAM support, DeepSpeed, narrator, model finetuning, custom models, wav file maintenance. It can also be used with 3rd Party software via JSON calls.
GNU Affero General Public License v3.0
1.09k stars 115 forks source link

pydantic>=2.5.0 not compatible with deepspeed & extension load fail #18

Closed rktvr closed 10 months ago

rktvr commented 10 months ago

on a windows 10 machine. since installing the finetune requirements, the extension no longer works correctly. previously, i had pydantic 1.10.13 installed, but with the new requirement i get this:

`E:\oobabooga\text-generation-webui-snapshot-2023-11-19\installer_files\env\Lib\site-packages\pydantic_internal_config.py:321: UserWarning: Valid config keys have changed in V2:

You may be able to resolve this warning by setting model_config['protected_namespaces'] = (). warnings.warn( 2023-12-24 19:05:51 ERROR:Failed to load the extension "alltalk_tts". Traceback (most recent call last): File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\modules\extensions.py", line 36, in load_extensions exec(f"import extensions.{name}.script") File "", line 1, in File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\extensions\alltalk_tts\script.py", line 50, in import deepspeed File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\installer_files\env\Lib\site-packages\deepspeed__init.py", line 22, in from . import module_inject File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\installer_files\env\Lib\site-packages\deepspeed\module_inject__init.py", line 6, in from .replace_module import replace_transformer_layer, revert_transformer_layer, ReplaceWithTensorSlicing, GroupQuantizer, generic_injection File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\installer_files\env\Lib\site-packages\deepspeed\module_inject\replace_module.py", line 580, in from ..pipe import PipelineModule File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\installer_files\env\Lib\site-packages\deepspeed\pipe\init__.py", line 6, in from ..runtime.pipe import PipelineModule, LayerSpec, TiedLayerSpec File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\installer_files\env\Lib\site-packages\deepspeed\runtime\pipe\init.py", line 6, in from .module import PipelineModule, LayerSpec, TiedLayerSpec File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\installer_files\env\Lib\site-packages\deepspeed\runtime\pipe\module.py", line 19, in from ..activation_checkpointing import checkpointing File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\installer_files\env\Lib\site-packages\deepspeed\runtime\activation_checkpointing\checkpointing.py", line 26, in from deepspeed.runtime.config import DeepSpeedConfig File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\installer_files\env\Lib\site-packages\deepspeed\runtime\config.py", line 29, in from .zero.config import get_zero_config, ZeroStageEnum File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\installer_files\env\Lib\site-packages\deepspeed\runtime\zero\init__.py", line 6, in from .partition_parameters import ZeroParamType File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\installer_files\env\Lib\site-packages\deepspeed\runtime\zero\partition_parameters.py", line 723, in class Init(InsertPostInitMethodToModuleSubClasses): File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\installer_files\env\Lib\site-packages\deepspeed\runtime\zero\partition_parameters.py", line 725, in Init param_persistence_threshold = get_config_default(DeepSpeedZeroConfig, "param_persistence_threshold") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\installer_files\env\Lib\site-packages\deepspeed\runtime\config_utils.py", line 116, in get_config_default field_name).required, f"'{field_name}' is a required field and does not have a default value" ^^^^^^^^ AttributeError: 'FieldInfo' object has no attribute 'required'`

if i remove pydantic>2.5.0 and instead do pydantic==1.10.13 i get:

[AllTalk Startup] TTS Subprocess starting [AllTalk Startup] Readme available here: http://127.0.0.1:7851 Traceback (most recent call last): File "E:\oobabooga\text-generation-webui-snapshot-2023-11-19\extensions\alltalk_tts\tts_server.py", line 25, in <module> from pydantic import field_validator ImportError: cannot import name 'field_validator' from 'pydantic' (E:\oobabooga\text-generation-webui-snapshot-2023-11-19\installer_files\env\Lib\site-packages\pydantic\__init__.cp311-win_amd64.pyd) [AllTalk Startup] Warning TTS Subprocess has NOT started up yet, Will keep trying for 120 seconds maximum. Please wait. [AllTalk Startup] Warning TTS Subprocess has NOT started up yet, Will keep trying for 120 seconds maximum. Please wait.

After having run the finetuning successfully, I moved the model files as written in the guide and then changed the cuda path back to what it was previously. So I'm not sure what broke.

rktvr commented 10 months ago

retrying on a fully new ooba install to make sure it's not something random i did on accident

erew123 commented 10 months ago

image

Im running both here without an issue... humm. Though I can see other references to that issue on the internet.

Let me think a minute

erew123 commented 10 months ago

maybe try an update to pydantic 2.5.3 like me... it may be a 2.5.0-2.5.2 pydantic issue... its an ass of a app at times.

pip install pydantic==2.5.3 when you have started the text-gen-webui with cmd_yourOS

erew123 commented 10 months ago

Ive downgraded pydantic to 2.5.0 on my system and its still all loading both AllTalk and FineTune ok. Humm. Your TTS version is 0.21.3 as well I assume pip show tts

image

rktvr commented 10 months ago

yeah, not sure what the issue is. image

currently installing a fresh ooba to see there. if it works there then something broke along the way i suppose.

erew123 commented 10 months ago

Right, I sort of know whats going on now.... model_persistence_threshold ok, so pydantic had this big issue about things being called "model" because it started internally using "model" and it complained that if you use "model" in your code, then there could be an issue where some variables get swapped between scripts. (something of that jist). It caused me a huge pain in the ass a week or so ago (which is why we now have a new confignew.json, rather than the config.json, as I had to re-name some variables).

Are you using one of the DeepSpeed installs that I put up? https://github.com/erew123/alltalk_tts/releases/tag/deepspeed

Im wondering if other versions from other people could have an issue maybe, as they all compile up differently.

rktvr commented 10 months ago

i have an older version of deepspeed, a wheel that someone posted a while back. deepspeed-11.1. am going to install the deepspeed 11.2 that you linked in the new ooba install. then if that works go back to my old one and see if changing to 11.2 fixes the issues.

as a unrelated side note, the extension folder can't have a minus "-" or "." in the name it seems, for those that install it manually by downloading from the release tab. the name "alltalk_tts-1.7" causes it to fail to load but works when renamed to "alltalk_tts"

S95Sedan commented 10 months ago

Edit as the first comment is a different error but the same module used: The error here seems to originate from the openai extension.

No idea if thats used to parse variables, but it seems linked to that.

Edit attached error: error

erew123 commented 10 months ago

@S95Sedan Good to know, well, good to know its something else in the mix. Are you suffering this issue too?

@rktvr The minus thing, that's a GitHub thing. As far as I know, I have no control over removing that - from the name, but you are correct, things in the extensions folder doesn't like a - in the name. Maybe ill put a note on them for people to rename them.

rktvr commented 10 months ago

it's not the openai extension in my case, i don't have it enabled and even removed it to test.

okay just installed deepspeed 11.2 and it seems fixed.

@erew123 seems it was deepspeed 11.1 that broke stuff, 11.2 seems like a hard requirement now (which is fine), just hard to figure out.

rktvr commented 10 months ago

something with the new pydantic then either way. but might be an issue for those that somehow rely on the openai extension

erew123 commented 10 months ago

@S95Sedan Ahh I see. Yeah, they just have to rename things in the openAI script not to have the name "model". I had to rename 2x variables in AllTalk to stop it clashing (according to Pydantic). I guess Ill pass a friendly message on to whomever codes the OpenAI add in and let them know. It should just be a find/replace on the script. Might be able to do it myself.

"model_loaded": true, "model_name": "tts_models/multilingual/multi-dataset/xtts_v2",

are now

"tts_model_loaded": true, "tts_model_name": "tts_models/multilingual/multi-dataset/xtts_v2",

erew123 commented 10 months ago

@rktvr Glad its sorted for you. And glad it was someone who knew their way around a system :) much easier to diagnose! Have a good Christmas

@S95Sedan Also a Happy Christmas to you too (and thanks for the info)

S95Sedan commented 10 months ago

it's not the openai extension in my case, i don't have it enabled and even removed it to test.

okay just installed deepspeed 11.2 and it seems fixed.

@erew123 seems it was deepspeed 11.1 that broke stuff, 11.2 seems like a hard requirement now (which is fine), just hard to figure out.

Just had a look but deepspeed 11.2 has a patch for pydantic in it, so thats why the error was there, see: https://github.com/microsoft/DeepSpeed/pull/4407

Hence 11.1 gives errors (same here when i rolled back the version.)

@erew123 No problem and you too. Rest aswell offcourse. Hopefully not more breaks when times goes by as 12.6 compiling is still a no-go.

erew123 commented 10 months ago

FYI, just so you know Pydantic 2.5.3 is now the base version Text-gen-webui installs as factory. The full "factory list" is at the bottom of this link here