python -m pip install --upgrade "pip<24.1" Due to how the new pip handles requirements
15 KiB
15 KiB
In [ ]:
#@markdown #####You can enable gdrive that drag and drop samples directly through your google drive via the `drive/Mydrive` path
mount_gdrive = False #@param{type:"boolean"}
if mount_gdrive:
from google.colab import drive
drive.mount('/content/drive')
from IPython.display import clear_output
print("*******************************************************************")
print("** Installing server requirements. This will take 5-10 minutes ****")
print("*******************************************************************")
!apt install libasound2-dev portaudio19-dev libportaudio2 libportaudiocpp0 libaio-dev espeak-ng > '/dev/null' 2>&1
clear_output()
print("************************")
print("*** Cloning AllTalk ****")
print("************************\n")
!git clone -b alltalkbeta https://github.com/erew123/alltalk_tts
clear_output()
print("\n********************************")
print("*** Installing Requirements ****")
print("********************************\n")
!python -m pip install --upgrade "pip<24.1"
!pip install --quiet -r /content/alltalk_tts/system/requirements/requirements_colab.txt
clear_output()
print("\n*****************************")
print("*** Installing DeepSpeed ****")
print("*****************************\n")
!pip install deepspeed
!pip install orjson
!pip install faiss-cpu
!pip install fairseq
clear_output()
print("\n******************************")
print("*** Installing Cloudflare ****")
print("******************************\n")
# Install cloudflare
!wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb > '/dev/null' 2>&1
!apt install ./cloudflared-linux-amd64.deb aria2 > '/dev/null' 2>&1
!rm cloudflared-linux-amd64.deb > '/dev/null' 2>&1
!python -m spacy download en_core_web_md
clear_output()
print("\n***************************")
print("*** Installing Cutlass ****")
print("***************************\n")
# Clone the CUTLASS repository
!git clone https://github.com/NVIDIA/cutlass.git
!export CUTLASSPATH=/content/cutlass
!sudo curl -L https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz -o /usr/local/bin/ffmpeg.tar.xz
clear_output()
%cd /usr/local/bin/
clear_output()
!7z e /usr/local/bin/ffmpeg.tar.xz -y
clear_output()
!7z e /usr/local/bin/ffmpeg.tar -y
clear_output()
!sudo chmod a+rx /usr/local/bin/ffmpeg
clear_output()
!pip uninstall jax -y
clear_output()
print("************************************")
print("** Server requirements installed ***")
print("*** Please proceed to next step ****")
print("************************************\n")
********************************
*** Installing Requirements ****
********************************
Collecting pip<24.1
Downloading pip-24.0-py3-none-any.whl.metadata (3.6 kB)
Downloading pip-24.0-py3-none-any.whl (2.1 MB)
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m2.1/2.1 MB[0m [31m71.1 MB/s[0m eta [36m0:00:00[0m
[?25hInstalling collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 24.1.2
Uninstalling pip-24.1.2:
Successfully uninstalled pip-24.1.2
Successfully installed pip-24.0
Installing build dependencies ... [?25l[?25hdone
Getting requirements to build wheel ... [?25l[?25hdone
Preparing metadata (pyproject.toml) ... [?25l[?25hdone
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m252.0/252.0 kB[0m [31m18.0 MB/s[0m eta [36m0:00:00[0m
[?25h Installing build dependencies ... [?25l[?25hdone
Getting requirements to build wheel ... [?25l[?25hdone
Preparing metadata (pyproject.toml) ... [?25l[?25hdone
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m47.4/47.4 MB[0m [31m18.5 MB/s[0m eta [36m0:00:00[0m
[?25h Preparing metadata (setup.py) ... [?25l[?25hdone
Preparing metadata (setup.py) ... [?25l[?25hdone
Preparing metadata (setup.py) ... [?25l[?25hdone
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m73.5/73.5 kB[0m [31m7.0 MB/s[0m eta [36m0:00:00[0m
[?25h Preparing metadata (setup.py) ... [?25l[?25hdone
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m138.0/138.0 kB[0m [31m12.1 MB/s[0m eta [36m0:00:00[0m
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m3.7/3.7 MB[0m [31m102.7 MB/s[0m eta [36m0:00:00[0m
[?25h Preparing metadata (setup.py) ... [?25l[?25hdone
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m101.6/101.6 kB[0m [31m9.6 MB/s[0m eta [36m0:00:00[0m
[?25h Preparing metadata (setup.py) ... [?25l[?25hdone
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m15.3/15.3 MB[0m [31m103.3 MB/s[0m eta [36m0:00:00[0m
[?25h Preparing metadata (setup.py) ... [?25l[?25hdone
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m31.4/31.4 MB[0m [31m19.8 MB/s[0m eta [36m0:00:00[0m
[?25h Preparing metadata (setup.py) ... [?25l[?25hdone
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m18.1/18.1 MB[0m [31m90.7 MB/s[0m eta [36m0:00:00[0m
[?25h Preparing metadata (setup.py) ... [?25l[?25hdone
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m10.9/10.9 MB[0m [31m23.5 MB/s[0m eta [36m0:00:00[0m
[?25h Preparing metadata (setup.py) ... [?25l[?25hdone
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m50.4/50.4 kB[0m [31m3.8 MB/s[0m eta [36m0:00:00[0m
[?25h Preparing metadata (setup.py) ... [?25l[?25hdone
Preparing metadata (setup.py) ... [?25l[?25hdone
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m59.6/59.6 kB[0m [31m5.2 MB/s[0m eta [36m0:00:00[0m
[?25h Preparing metadata (setup.py) ... [?25l[?25hdone
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m64.2/64.2 kB[0m [31m5.7 MB/s[0m eta [36m0:00:00[0m
[?25h Preparing metadata (setup.py) ... [?25l[?25hdone
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m88.4/88.4 kB[0m [31m7.9 MB/s[0m eta [36m0:00:00[0m
[?25h Preparing metadata (setup.py) ... [?25l[?25hdone
[2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [32m417.9/417.9 MB[0m [31m1.3 MB/s[0m eta [36m0:00:00[0m
[2K [91m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m[91m╸[0m [32m663.9/663.9 MB[0m [31m84.9 MB/s[0m eta [36m0:00:01[0mIn [ ]:
#@markdown Links to the API and Gradio interface will be shown when AllTalk has loaded in.<br>
#@markdown The API address is what you would use in SillyTavern.
import re
import time
import json
import threading
import time
def keep_alive():
while True:
time.sleep(60) # Run every 60 seconds (adjust as needed)
keep_alive_thread = threading.Thread(target=keep_alive)
keep_alive_thread.start()
Tunnel = "cloudflare"
host = "127.0.0.1"
ports = [7851, 7852]
tunnel_urls = []
# Starting tunnels for each port.
for port in ports:
if Tunnel == "cloudflare":
!nohup cloudflared tunnel --url http://{host}:{port} > lt_{port}.log 2>&1 &
else:
!nohup npx lt -p {port} > lt_{port}.log 2>&1 &
# Wait a couple of seconds for the tunnels to initialize.
time.sleep(10)
# Extract URLs for each tunnel.
for port in ports:
log_file = f'lt_{port}.log'
with open(log_file, 'r') as testwritefile:
log_content = testwritefile.read()
# Use regular expressions to find the URL.
if Tunnel == "cloudflare":
url_match = re.search(r'(https://[-a-z0-9]+\.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(1)
tunnel_urls.append(tunnel_url)
else:
print(f"URL for port {port} not found.")
# Save the tunnel URLs to a JSON file.
try:
# Try to open the JSON file for reading.
with open('/content/alltalk_tts/googlecolab.json', 'r') as f:
data = json.load(f)
except FileNotFoundError:
# If the file doesn't exist, create an empty dictionary.
data = {}
data['google_ip_address'] = tunnel_urls
# Write the modified data (or newly created data) back to the file.
with open('/content/alltalk_tts/googlecolab.json', 'w') as f:
json.dump(data, f)
host = "0.0.0.0"
if Tunnel == "localtunnel":
print("Before you copy the link above click on it and copy that ip:")
!curl ipv4.icanhazip.com
# Start API server.
!python /content/alltalk_tts/script.py