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
686 stars 71 forks source link

Unable to connect #262

Closed sanihaq closed 2 weeks ago

sanihaq commented 2 weeks ago

AllTalk Server] Warning Unable to connect to the AllTalk server. Status code: HTTPConnectionPool(host='127.0.0.1', port=7851): Max retries exceeded with url: /api/voices (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f41d1854990>: Failed to establish a new connection: [Errno 111] Connection refused'))

erew123 commented 2 weeks ago

Hi @sanihaq

You will have to give me more information about the version of AllTalk you are using (1 or 2) and your setup+what exactly you are doing when you are seeing this error. Preferably a diagnostics log too, which you can create with atsetup.bat

Thanks

sanihaq commented 2 weeks ago

Hello @erew123 , sorry for not providing more info. i was trying the dev branch (following your instruction readme) on lightning.ai . i guess it was failing to bind the port, i was not sure it was problem from lightning.ai or your codebase. although i was able to install others like https://github.com/idiap/coqui-ai-TTS. i tried to create a diagnostics log, but it failed, sorry.

erew123 commented 2 weeks ago

Hi @sanihaq I am going to assume you are using v2 (the BETA) and have connected to the Gradio interface, but over the internet. Does that sound about correct?

Because of the way it AllTalk works internally, there are 2x web servers and quite complicated to explain, but it will not just liven up on other services yet. In short, it would be trying to internally communicate on 127.0.0.1, which cant happen over the internet, as that isnt a routable address (I wont go further explaining this. If you understand TCPIP routing Im sure you will understand, and if you dont understand TCPIP routing, its a good days reading to maybe get to grips with why its a problem).

You can use Google colab if you wish. There is an importable ipynb file for google colab https://github.com/erew123/alltalk_tts/blob/alltalkbeta/googlecolab.ipynb

Or you could activate a tunnelling setup from other services, similar to how the Google colab initiates a tunnel to the inner workings of the server.

Finally, its possible to do a public share on Gradio that would give you an address that you could access and avoid routing issues (similar to how tunnelling works), though it would need a minor code change to do that.

Not sure if any of those would work for you as solutions?

sanihaq commented 2 weeks ago

@erew123 thanks for the detailed response, yes it was v2 (BETA). and for other explanation, sorry i didn't get all of that. but i don't think it was over the internet. but i don't know how lightning.ai works exactly. but it's instances behave like a normal linux(arch) os would behave.

erew123 commented 2 weeks ago

Hi @sanihaq

I've looked at their video on exposing things to the internet https://www.loom.com/share/5a020b5b879940d29f7209ee07c2148f?t=9

In short the Gradio interface of AllTalk would need some extra code work to work with lightning.ai.

In V2 of AllTalk, there are 2x addresses. 1x address is for the API address and the other is for the Gradio interface (I display this as a light and dark version of gradio interface mind).

image

When its run on a non-local computer, the Gradio interface needs to be pointed at the destination of the API URL, otherwise it will only try to send to 127.0.0.1 (your original error), which it cannot reach without extra setup.

Current simple options are:

1) Run AllTalk v2 on free Google Colab with the ipynb file I mention https://github.com/erew123/alltalk_tts/blob/alltalkbeta/googlecolab.ipynb You would log into google colab, open this file and click the play buttons, which will do everything for you and setup AllTalk v2.

OR

2) Edit line 2005 of script.py before you start AllTalk v2 on the lightning.ai server and this will use Gradio sharing, which is the equivalent of starting a tunnel. Note however that this will NOT share the API address over the internet. This will only get the Gradio interface working correctly. Please see here for a quick reference of editing that file https://github.com/erew123/alltalk_tts/discussions/245#discussioncomment-9921683 you would add share=True to that line, as shown.

If you wish to do any other form of Tunnelling/Routing for sharing AllTalk over the internet, you will need to share port 7851 for the API, so that things such as SillyTavern or of the like could access the API.

If you wanted the Gradio interface live, it is shared on 7852, but without tunnelling configured OR without adding additional code to identify when it is running on something like lightning's systems, the Gradio interface cannot see the API address.

I appreciate this is quite a complicated topic, however I hope that gives you a couple of suggestions.

sanihaq commented 2 weeks ago

@erew123 hello thanks for the help but unfortunately id did not work i would like to give you access to to the instance if possible, if you are interested. gradio port is working, api port is not.

sanihaq commented 2 weeks ago

@erew123 ok, got api working but unable to generate from gradio

# script.py line 348
if False: # os.path.isfile("/.dockerenv") and 'google.colab' not in sys.modules:
    print(f"[{branding}TTS] \033[94mRunning in Docker. Please wait.\033[0m")
else:
    ....

got some info error

[AllTalk Startup] Info PortAudio library not found. If you wish to play TTS in standalone mode through the API suite [AllTalk Startup] Info please install PortAudio. This will not affect any other features or use of Alltalk. [AllTalk Startup] Info If you don't know what the API suite is, then this message is nothing to worry about. [AllTalk Startup] Info On Linux, you can use the following command to install PortAudio: [AllTalk Startup] Info sudo apt-get install portaudio19-dev

erew123 commented 2 weeks ago

Hi @sanihaq

Did you run the sudo command pre-setting up AllTalk?

https://github.com/erew123/alltalk_tts/tree/alltalkbeta?tab=readme-ov-file#linux-systems

You just need to run these somewhere, however it is you are allowed to run this command line.

Thanks

sanihaq commented 2 weeks ago

@erew123 yes i have run the command and i do have permission to run sudo command

sudo apt install libaio-dev espeak-ng ffmpeg gcc g++

however the same problem is still there.

erew123 commented 2 weeks ago

Hi @sanihaq Ill take quick look at some point, however, looks like I have to wait for them to verify the account:

image

sanihaq commented 2 weeks ago

@erew123 i appreciate the effort, you will get 15 free credit, i suggest you try a fresh install on your own. please let me know how it goes... p.s. i will be happy to help, any way i can

erew123 commented 1 week ago

Hi @sanihaq

I have managed to have a brief look at this, now they have verified me. The answer is that this is a docker based environment.

image

Docker environments potentially need additional setup scripts, though its also possible that AllTalk v2 may not need these scripts. I have yet to work on and validate a docker environment setup, due to the fact it will take me hours of testing and Ive not had time yet.

Until I get time to do that, the TTS engines will not start.

erew123 commented 1 week ago

Hi @sanihaq I will look to get something sorted with docker related builds. I tried yesterday, but unfortunately every time I tried, other things took me in other directions and I couldnt get time.

If I get chance this weekend I will, however, If I dont, it may be later next week as I have potential travel lined up to deal with an ongoing family situation.

Thanks

sanihaq commented 1 week ago

Hi @erew123 thanks for making time for this. as i mentioned before, the docker thing is not the problem you can easily change a bit of code to bypass it, and lightningai has docker built in however you dont have to use it. heres the code you need to change (perhaps more gracefully)

# script.py line 348
if False: # os.path.isfile("/.dockerenv") and 'google.colab' not in sys.modules:
    print(f"[{branding}TTS] \033[94mRunning in Docker. Please wait.\033[0m")
else:
    ....

the api port will work correctly, the gradio interface will open but you won be able generate from gradio, i even check the long text generation and everything works in api. i think theres some logical problem in your code please check the code i mention above. thanks

p.s. I prefer running things without docker in lightning ai. that way startup time is slower, and everything stays in place, docker is weird in lightning every time you start an instance its need download and setup everything from scratch, container, images get deleted every time, when you shutdown 😞

erew123 commented 1 week ago

Hi @sanihaq

Its somewhat more complicated than just removing the code. On the previous version of AllTalk, there was a specific docker build setup that would initiate the tts_script separate to that of the normal script start-up https://github.com/erew123/alltalk_tts/blob/main/Dockerfile launch.sh

Im not sure this is or isnt needed yet for v2, however, the purpose of having it identify that it starts in docker, is similar to how its used to identify that it starts in google colab. Specifically there are changes within the code needed to re-map certain parts of the script to make them externally available OR work with tunnelling e.g. exposing certain ports like in this https://github.com/erew123/alltalk_tts/blob/main/docker-compose-cuda.yml and then potentially creating a tunnel map into the system like in the google colab build https://github.com/erew123/alltalk_tts/blob/alltalkbeta/googlecolab.ipynb

Which is how the google colab build provides routed tunnel addresses:

image

Rather than internal IP addresses:

image

So its that, that I will need to work on, as well as ensuring the Docker script installs all the other requirements that the OS needs.

The logic problem as you put it, is related to the way the system works. There isn't a logic problem, its just that it needs to be aware that communication between the Gradio interface and TTS engines are routed over the internet and not internally, which can only be done by identifying what the system is started on, then it can identify how to route IP traffic between the Gradio interface and the TTS engines web server.

To put it another way, there are 2x web servers running within AllTalk (for various reasons). 1x is gradio and 1x is the tts engines. To have communication work between them, when running outside of a LAN, you have to get them to provide additional routing information beyond 127.0.0.1 for internal communication.

I just havnt had time to work in it yet, but will at some point soon.

Thanks