Back to Ebook2audiobook

@title 🛠️ Install requirments

Notebooks/finetune/xtts/kaggle-xtts-finetune-webui-gradio-gui.ipynb

26.5.44.2 KB
Original Source

Welcome to the xtts-finetune-webui gradio gui!

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

Disclamer this version should be considered alpha/beta!

Potential issues

  • float16 is disabled and float32 is used (not sure how to get float16 to work with kaggle)
  • this doesn't use kaggles persistant output directory as its limited to 20gb make sure to download models before ending sessions
  • the main disk is limited to 57 gb (you can go over it, it wont immediatly stop, but kaggle can crash at anytime)
python
# @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
python
!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:

https://github.com/Rihcus/xtts-finetune-webui/blob/2345589fb773a32b6f48b8f1aa7f4eca1aab476b/xtts_demo.py#L309

python
# @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

python
# 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}")