diff --git a/README.md b/README.md index b0cde73fef..1ca585d7ba 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,31 @@ If you are on Windows, 👑@GuyPaddock wrote installation instructions [here](ht ``` $ tts --list_models ``` - +- Get model info (for both tts_models and vocoder_models): + - Query by type/name: + The model_info_by_name uses the name as it from the --list_models. + ``` + $ tts --model_info_by_name "///" + ``` + For example: + + ``` + $ tts --model_info_by_name tts_models/tr/common-voice/glow-tts + ``` + ``` + $ tts --model_info_by_name vocoder_models/en/ljspeech/hifigan_v2 + ``` + - Query by type/idx: + The model_query_idx uses the corresponding idx from --list_models. + ``` + $ tts --model_info_by_idx "/" + ``` + For example: + + ``` + $ tts --model_info_by_idx tts_models/3 + ``` + - Run TTS with default models: ``` diff --git a/TTS/utils/manage.py b/TTS/utils/manage.py index 281e5af02a..5eed6683e6 100644 --- a/TTS/utils/manage.py +++ b/TTS/utils/manage.py @@ -1,4 +1,3 @@ -import io import json import os import zipfile @@ -7,6 +6,7 @@ from typing import Dict, Tuple import requests +from tqdm import tqdm from TTS.config import load_config from TTS.utils.generic_utils import get_user_data_dir @@ -337,11 +337,20 @@ def _update_path(field_name, new_path, config_path): def _download_zip_file(file_url, output_folder): """Download the github releases""" # download the file - r = requests.get(file_url) + r = requests.get(file_url, stream=True) # extract the file try: - with zipfile.ZipFile(io.BytesIO(r.content)) as z: + total_size_in_bytes = int(r.headers.get("content-length", 0)) + block_size = 1024 # 1 Kibibyte + progress_bar = tqdm(total=total_size_in_bytes, unit="iB", unit_scale=True) + temp_zip_name = os.path.join(output_folder, file_url.split("/")[-1]) + with open(temp_zip_name, "wb") as file: + for data in r.iter_content(block_size): + progress_bar.update(len(data)) + file.write(data) + with zipfile.ZipFile(temp_zip_name) as z: z.extractall(output_folder) + os.remove(temp_zip_name) # delete zip after extract except zipfile.BadZipFile: print(f" > Error: Bad zip file - {file_url}") raise zipfile.BadZipFile # pylint: disable=raise-missing-from