tortoise-tts icon indicating copy to clipboard operation
tortoise-tts copied to clipboard

ImportError: cannot import name 'Annotated' from 'pydantic.typing'

Open 7syringe opened this issue 1 year ago • 8 comments

Everytime I try to generate a TTS, I get this error:

`(base) C:\Users\austi\tortoise-tts>python tortoise/do_tts.py --text "I'm going to speak this" --voice random --preset fastconda install mkl mkl-include

Traceback (most recent call last): File "C:\Users\austi\tortoise-tts\tortoise\do_tts.py", line 7, in from api import TextToSpeech, MODELS_DIR File "C:\Users\austi\tortoise-tts\tortoise\api.py", line 24, in from tortoise.utils.tokenizer import VoiceBpeTokenizer File "C:\Users\austi\anaconda3\lib\site-packages\tortoise-2.4.2-py3.10.egg\tortoise\utils\tokenizer.py", line 4, in import inflect File "C:\Users\austi\anaconda3\lib\site-packages\inflect-6.0.4-py3.10.egg\inflect_init_.py", line 77, in from pydantic.typing import Annotated ImportError: cannot import name 'Annotated' from 'pydantic.typing' (C:\Users\austi\anaconda3\lib\site-packages\pydantic-2.0a3-py3.10.egg\pydantic\typing.py)`

7syringe avatar Apr 27 '23 07:04 7syringe

Install seems broken right now I've followed the install to a T and still getting multiple errors, Been trying to make this work for over a week now.. I'm using Anaconda as well..

CodexOmega avatar Apr 27 '23 16:04 CodexOmega

conda create --name tortoise python=3.9 numba inflect
conda activate tortoise
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
git clone https://github.com/neonbjb/tortoise-tts.git
cd tortoise-tts
python setup.py install

See my conda installation instructions here. Start fresh — reset your base conda environment if needed with:

conda install --rev 1

Also a pull request I made to adjust the current README.md.

n8bot avatar Apr 28 '23 01:04 n8bot

conda create --name tortoise python=3.9 numba inflect
conda activate tortoise
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
git clone https://github.com/neonbjb/tortoise-tts.git
cd tortoise-tts
python setup.py install

See my conda installation instructions here. Start fresh — reset your base conda environment if needed with:

conda install --rev 1

Also a pull request I made to adjust the current README.md.

You're a genius. thank you so much for the help.

Now my issue is Generating autoregressive samples.. 0%| | 0/32 [00:00<?, ?it/s]

Any ideas on why it isn't progressing? Thanks so much!

7syringe avatar Apr 28 '23 06:04 7syringe

The first iteration shows like that. Sometimes the iterations can be up to a minute long or more if you had a long prompt, and if you are using the gpu for other things.

Try the ultra_fast preset, close all other apps, and use a short prompt for a test.

n8bot avatar Apr 28 '23 06:04 n8bot

The first iteration shows like that. Sometimes the iterations can be up to a minute long or more if you had a long prompt, and if you are using the gpu for other things.

Try the ultra_fast preset, close all other apps, and use a short prompt for a test.

Right as you commented it started moving! Appreciate your help :)

7syringe avatar Apr 28 '23 06:04 7syringe

I was going through the same issue with a different repo and this solved it for me:

In the inflect init.py, for your case this path: C:\Users\austi\anaconda3\lib\site-packages\inflect-6.0.4-py3.10.egg\inflect_init.py__,

Replace the pydantic.typing import with the typing_extensions import like this:

# from pydantic.typing import Annotated from typing_extensions import Annotated

I got this from the pydantic site itself - https://docs.pydantic.dev/latest/usage/strict_mode/#strict-mode-with-annotated-strict. For full context, I'm using a python==3.8.0 miniconda env on Ubuntu 22.04

markjacksoncerberus avatar Jul 14 '23 16:07 markjacksoncerberus

我正在用不同的 repo 遇到同样的问题,这为我解决了它:

在 inflect init.py 中,对于您的情况,此路径:C:\Users\austi\anaconda3\lib\site-packages\inflect-6.0.4-py3.10.egg\inflect_init.py__,

将 pydantic.typing import 替换为 typing_extensions 导入,如下所示:

# from pydantic.typing import Annotated from typing_extensions import Annotated

我从 pydantic 网站本身得到了这个 - https://docs.pydantic.dev/latest/usage/strict_mode/#strict-mode-with-annotated-strict。为了获得完整的上下文,我在 Ubuntu 22.04 上使用 python==3.8.0 miniconda env

thanks you . not you i con't fixed it.

wcyy avatar Nov 05 '23 03:11 wcyy

我正在用不同的 repo 遇到同样的问题,这为我解决了它:

在 inflect init.py 中,对于您的情况,此路径:C:\Users\austi\anaconda3\lib\site-packages\inflect-6.0.4-py3.10.egg\inflect_init.py__,

将 pydantic.typing import 替换为 typing_extensions 导入,如下所示:

# from pydantic.typing import Annotated from typing_extensions import Annotated

我从 pydantic 网站本身得到了这个 - https://docs.pydantic.dev/latest/usage/strict_mode/#strict-mode-with-annotated-strict。为了获得完整的上下文,我在 Ubuntu 22.04 上使用 python==3.8.0 miniconda env

is good .you can to fix the primitive question ,you will help lots of people

wcyy avatar Nov 05 '23 03:11 wcyy