Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The colab is not working anymore #78

Open
LostRuins opened this issue May 31, 2024 · 9 comments
Open

The colab is not working anymore #78

LostRuins opened this issue May 31, 2024 · 9 comments

Comments

@LostRuins
Copy link

It seems like the colab is not working anymore, possibly due to some updated python packages?

@VermiNew
Copy link

VermiNew commented Jun 4, 2024

Try this, it should work (Works for me):

load_samples = True

print("Installing Packages and Dependencies\nPlease wait 2-3 minutes")
!npm install localtunnel
!apt install libasound2-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg -y

print("Installing main packages...")
!pip install torch==2.1.1+cu118 torchaudio==2.1.1+cu118 --index-url https://download.pytorch.org/whl/cu118
print("Installing XTTS-V2 API SERVER...")
!pip install xtts-api-server
print("Force reinstalling numpy packet... 'numpy==1.26.2'...")
!pip install --force-reinstall numpy==1.26.2

# Install cloudflare as alternative
!wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
!apt install ./cloudflared-linux-amd64.deb aria2 -y
!rm cloudflared-linux-amd64.deb

# Deepspeed
print("Installing deepspeed...")
!pip install deepspeed

# copy exaple sample
if load_samples:
    print("Creating folder... 'speakers'...")
    !mkdir speakers

print("Finally, done!")

@VermiNew
Copy link

VermiNew commented Jun 17, 2024

Try using my code:

print("Installing Packages and Dependencies\nPlease wait...\n\n")

# =-=-=-=-=-=-=-=-=-=-=-=-=-=- DO NOT EDIT CODE HERE =-=-=-=-=-=-=-=-=-=-=-=-=-=-
# NPM Update
print("Updating npm...")
!npm install -g npm@10.8.1

# Localtunnel
print("Installing localtunnel...")
!npm install localtunnel

# Linux packages
print("Installing audio dependencies and other required packages...")
!apt install libasound2-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg -y

# PyTorch
print("Installing main packages...")
!pip install torch==2.1.1+cu118 torchaudio==2.1.1+cu118 --index-url https://download.pytorch.org/whl/cu118

# TTS for API Server
print("Installing TTS...")
!pip install TTS

# XTTS API Server
print("Installing XTTS API Server...")
!pip install --upgrade xtts-api-server

# Numpy
print("Reinstalling numpy...")
!pip install --force-reinstall numpy==1.26.2

# Deepspeed library installation
print("Installing deepspeed...")
!pip install deepspeed

# Install cloudflare as alternative
print("Installing cloudflare...")
!wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
!apt install ./cloudflared-linux-amd64.deb aria2 -y
!rm cloudflared-linux-amd64.deb

# Create speakers folder for TTS voices
print('Creating folder named "speakers"...')
!mkdir speakers

# Done
print("-" * 21)
print("-->\t\tFinally, done!")
print("-" * 21)
print("Now you can start next cell.")
print("-" * 21)
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

# TTS Code
import subprocess
import re

use_deepspeed = True
Tunnel = "localtunnel"
Model_version = "v2.0.3"
Model_source = "local"

# =-=-=-=-=-=-=-=-=-=-=-=-=-=- DO NOT EDIT CODE HERE =-=-=-=-=-=-=-=-=-=-=-=-=-=-
group = 1
host = "127.0.0.1"

def pip_list_comma_separated():
    result = subprocess.run(['pip', 'list'], stdout=subprocess.PIPE)
    pip_list_output = result.stdout.decode('utf-8')
    lines = pip_list_output.splitlines()

    package_lines = lines[2:]
    packages = [line.split()[0] for line in package_lines]
    comma_separated_packages = ', '.join(packages)

    print(comma_separated_packages)

# Display installed libraries
print("-" * 21)
print("Displaying installed libraries...")
pip_list_comma_separated()
print("-" * 21)

# Starting a tunnel.
print(f"Starting tunnel using {Tunnel}...")
if Tunnel == "cloudflare":
    subprocess.Popen(['cloudflared', '--url', 'http://127.0.0.1:8020'], stdout=open('lt.log', 'w'), stderr=subprocess.STDOUT)
    group -= 1
else:
    subprocess.Popen(['npx', 'lt', '-p', '8020'], stdout=open('lt.log', 'w'), stderr=subprocess.STDOUT)
    print()

print("Checking...")
tunnel_url = ''

# Open the file for reading.
print("Reading tunnel log...")
with open('lt.log', 'r') as testwritefile:
    log_content = testwritefile.read()
    url_match = ""

    # Use regular expressions to find the URL.
    if Tunnel == "cloudflare":
        url_match = re.search(r'https:\/\/[a-z-]+\.trycloudflare\.com', log_content)
    else:
        url_match = re.search(r'your url is: (https?://\S+)', log_content)

    if url_match:
        tunnel_url = url_match.group(group)
        print(f"Your url for SillyTavern: {tunnel_url}")
    else:
        print("URL not found.")

if Model_source == "api":
    host = "0.0.0.0"

if Tunnel == "localtunnel":
    print("Fetching your public IP address...")
    !curl ipv4.icanhazip.com

print("\n" + "-" * 21)

# Deepspeed
deepspeed_flag = ""
if use_deepspeed:
    deepspeed_flag = "--deepspeed"

# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Start API server.
print("Starting API server...")
!python -m xtts_api_server {deepspeed_flag} -hs {host} -t {tunnel_url} -ms {Model_source} -v {Model_version}
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

@LostRuins
Copy link
Author

Cool thanks. Hoping this project stays maintained

@VermiNew
Copy link

No problem, I also hope they don't abandon this project because I use this TTS for my private AI and would be saddened by a change to another solution.

@yoshuzx
Copy link

yoshuzx commented Jul 12, 2024

Still broken

@VermiNew
Copy link

VermiNew commented Jul 14, 2024

import subprocess
import re

print("Installing Packages and Dependencies\nPlease wait...\n\n")

# =-=-=-=-=-=-=-=-=-=-=-=-=-=- DO NOT EDIT CODE HERE =-=-=-=-=-=-=-=-=-=-=-=-=-=-
# NPM Update
print("Updating npm...")
!npm install -g npm@10.8.1

# Localtunnel
print("Installing localtunnel...")
!npm install localtunnel

# Linux packages
print("Installing audio dependencies and other required packages...")
!apt install libasound2-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg -y

# XTTS API Server
print("Installing XTTS API Server...")
!pip install --upgrade xtts-api-server

# Numpy
print("Reinstalling numpy...")
!pip install --force-reinstall numpy==1.26.2

# Deepspeed library installation
print("Installing deepspeed...")
!pip install deepspeed

# Install cloudflare as alternative
print("Installing cloudflare...")
!wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
!apt install ./cloudflared-linux-amd64.deb aria2 -y
!rm cloudflared-linux-amd64.deb

# Create speakers folder for TTS voices
print('Creating folder named "speakers"...')
!mkdir speakers

# TTS Code
use_deepspeed = True
Tunnel = "localtunnel"
Model_version = "v2.0.3"
Model_source = "local"

# =-=-=-=-=-=-=-=-=-=-=-=-=-=- DO NOT EDIT CODE HERE =-=-=-=-=-=-=-=-=-=-=-=-=-=-
group = 1
host = "127.0.0.1"

def pip_list_comma_separated():
    result = subprocess.run(['pip', 'list'], stdout=subprocess.PIPE)
    pip_list_output = result.stdout.decode('utf-8')
    lines = pip_list_output.splitlines()

    package_lines = lines[2:]
    packages = [line.split()[0] for line in package_lines]
    comma_separated_packages = ', '.join(packages)

    print(comma_separated_packages)

# Display installed libraries
print("-" * 21)
print("Displaying installed libraries...")
pip_list_comma_separated()
print("-" * 21)

# Starting a tunnel.
print(f"Starting tunnel using {Tunnel}...")
if Tunnel == "cloudflare":
    subprocess.Popen(['cloudflared', '--url', 'http://127.0.0.1:8020'], stdout=open('lt.log', 'w'), stderr=subprocess.STDOUT)
    group -= 1
else:
    subprocess.Popen(['npx', 'lt', '-p', '8020'], stdout=open('lt.log', 'w'), stderr=subprocess.STDOUT)
    print()

print("Checking...")
tunnel_url = ''

# Open the file for reading.
print("Reading tunnel log...")
with open('lt.log', 'r') as testwritefile:
    log_content = testwritefile.read()
    url_match = ""

    # Use regular expressions to find the URL.
    if Tunnel == "cloudflare":
        url_match = re.search(r'https:\/\/[a-z-]+\.trycloudflare\.com', log_content)
    else:
        url_match = re.search(r'your url is: (https?://\S+)', log_content)

    if url_match:
        tunnel_url = url_match.group(group)
        print(f"Your url for SillyTavern: {tunnel_url}")
    else:
        print("URL not found.")

if Model_source == "api":
    host = "0.0.0.0"

if Tunnel == "localtunnel":
    print("Fetching your public IP address...")
    !curl ipv4.icanhazip.com

print("\n" + "-" * 21)

# Deepspeed
deepspeed_flag = ""
if use_deepspeed:
    deepspeed_flag = "--deepspeed"

# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Start API server.
print("Starting API server...")
!python -m xtts_api_server {deepspeed_flag} -hs {host} -t {tunnel_url} -ms {Model_source} -v {Model_version}
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

@VermiNew
Copy link

VermiNew commented Jul 14, 2024

@yoshuzx I hope it's working for you now again because it's working (somehow) for me.

@TalkativeBat
Copy link

Hi,

I'm having an issue with the Colab where I believe it is running properly (I get as far as being able to play back voice samples on the SillyTavern UI) but when I try to generate audio, either for a new message or playback of an existing message, I get the error "TypeError: NetworkError when attempting to fetch resource."

Also, when I set up the localtunnel link to the TTS API on the Colab, the voice options and sample audio playbacks are only available for a few seconds or so before the portal seems to stop working and it says I need to recheck my API connection.

Trying this on the staged version of SillyTavern right now. I can replicate my run of the Colab book if needed, but if you have a simple quick fix based on the info I've provided, that would be super helpful. Thanks!

@Mertsudo
Copy link

still broken for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants