Notebooks/finetune/xtts/kaggle-xtts-finetune-webui-gradio-gui.ipynb
This webui is a slightly modified copy of the official webui for finetune xtts.
If you are looking for an option for normal XTTS use look here https://github.com/daswer123/xtts-webui
# @title 🛠️ Install requirments
#!DEBIAN_FRONTEND=noninteractive
!sudo apt-get update # && sudo apt-get -y upgrade
!sudo apt-get -y install libegl1
!sudo apt-get -y install libopengl0
!sudo apt-get -y install libxcb-cursor0
!pip install -r https://raw.githubusercontent.com/daswer123/xtts-finetune-webui/main/requirements.txt
!pip install gradio==4.44.1
!pip install fastapi==0.103.1
!pip install pydantic==2.3.0
!nvcc --version
!apt-get install libcudnn9-cuda-12 9.1.0 #fix a dependency issue
The code is basically the same as:
https://github.com/daswer123/xtts-webui
Only change to repo is that float16 is changed to float32:
# @title 🚀 Run interface
%cd /tmp/
!git clone https://github.com/Rihcus/xtts-finetune-webui #float16 is swapped to float32
%cd /tmp/xtts-finetune-webui
!python xtts_demo.py --share
This part was from colab version not using it here
# import shutil
# import requests
# import os
# from tqdm import tqdm # Progress bar library
# # Define the paths
# finetune_dir = '/content/xtts-finetune-webui/finetune_models/ready' # @param {type:"string"}
# dataset_dir = '/content/xtts-finetune-webui/finetune_models/dataset' # @param {type:"string"}
# # Create a temporary directory to collect both folders before zipping
# temp_dir = "/content/temp_finetune_dataset"
# os.makedirs(temp_dir, exist_ok=True)
# # Copy both directories into the temporary directory with a progress bar
# def copy_with_progress(src, dst):
# total_files = sum(len(files) for _, _, files in os.walk(src))
# with tqdm(total=total_files, desc=f"Copying {os.path.basename(src)}") as pbar:
# for root, _, files in os.walk(src):
# rel_path = os.path.relpath(root, src)
# target_path = os.path.join(dst, rel_path)
# os.makedirs(target_path, exist_ok=True)
# for file in files:
# shutil.copy(os.path.join(root, file), target_path)
# pbar.update(1)
# copy_with_progress(finetune_dir, os.path.join(temp_dir, "ready"))
# copy_with_progress(dataset_dir, os.path.join(temp_dir, "dataset"))
# # Create a zip file of the combined directories with progress
# zip_filename = "finetune_and_dataset.zip"
# with tqdm(total=100, desc="Zipping files") as pbar:
# shutil.make_archive("finetune_and_dataset", 'zip', root_dir=temp_dir)
# pbar.update(100)
# # Define a function to stream the upload with a progress bar
# def upload_with_progress(file_path, url):
# file_size = os.path.getsize(file_path)
# with open(file_path, 'rb') as f, tqdm(
# total=file_size, unit='B', unit_scale=True, desc="Uploading"
# ) as progress:
# response = requests.post(
# url,
# files={"file": (file_path, f)},
# stream=True,
# headers={"Connection": "keep-alive"},
# )
# # Update the progress bar as chunks are sent
# for chunk in response.iter_content(chunk_size=4096):
# if chunk:
# progress.update(len(chunk))
# return response
# # Upload the zip file to file.io with a progress bar
# response = upload_with_progress(zip_filename, "https://file.io/?expires=1d")
# # Parse the response and display the download link
# if response.status_code == 200:
# download_link = response.json().get('link', 'Error: No link found.')
# print(f"Your file is ready: {download_link}")
# else:
# print(f"Failed to upload: {response.status_code} - {response.text}")