mirror of
https://github.com/coqui-ai/TTS.git
synced 2025-12-20 02:09:29 +01:00
* initial commit * Tortoise inference * revert path change * style fix * remove accidental remove * style fixes * style fixes * removed unwanted assests and deps * remove changes * remove cvvp * style fix black * added tortoise config and updated config and args, refactoring the code * added tortoise to api * Pull mel_norm from url * Use TTS cleaners * Let download model files * add ability to pass tortoise presets through coqui api * fix tests * fix style and tests * fix tts commandline for tortoise * Add config.json to tortoise * Use kwargs * Use regular model api for loading tortoise * Add load from dir to synthesizer * Fix Tortoise floats * Use model_dir when there are multiple urls * Use `synthesize` when exists * lint fixes and resolve preset bug * resolve a download bug and update model link * fix json * do tortoise inference from voice dir * fix * fix test * fix speaker id and remove assests * update inference_tests.yml * replace inference_test.yml * fix extra dir as None * fix tests * remove space * Reformat docstring * Add docs * Update docs * lint fixes --------- Co-authored-by: Eren Gölge <egolge@coqui.ai> Co-authored-by: Eren Gölge <erogol@hotmail.com>
109 lines
3.3 KiB
Plaintext
109 lines
3.3 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "4d50310e-f094-42e0-af30-1e42b13ceb95",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"#@title # Setup\n",
|
|
"# Imports used through the rest of the notebook.\n",
|
|
"import torch\n",
|
|
"import torchaudio\n",
|
|
"import torch.nn as nn\n",
|
|
"import torch.nn.functional as F\n",
|
|
"\n",
|
|
"import IPython\n",
|
|
"\n",
|
|
"from TTS.tts.models.tortoise import TextToSpeech\n",
|
|
"from TTS.tts.layers.tortoise.audio_utils import load_audio, load_voice, load_voices\n",
|
|
"\n",
|
|
"# This will download all the models used by Tortoise from the HuggingFace hub.\n",
|
|
"tts = TextToSpeech()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "e126c3c3-d90a-492f-b5bb-0d86587f15cc",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# This is the text that will be spoken.\n",
|
|
"text = \"Joining two modalities results in a surprising increase in generalization! What would happen if we combined them all?\" #@param {type:\"string\"}\n",
|
|
"#@markdown Show code for multiline text input\n",
|
|
"# Here's something for the poetically inclined.. (set text=)\n",
|
|
"\"\"\"\n",
|
|
"Then took the other, as just as fair,\n",
|
|
"And having perhaps the better claim,\n",
|
|
"Because it was grassy and wanted wear;\n",
|
|
"Though as for that the passing there\n",
|
|
"Had worn them really about the same,\"\"\"\n",
|
|
"\n",
|
|
"# Pick a \"preset mode\" to determine quality. Options: {\"ultra_fast\", \"fast\" (default), \"standard\", \"high_quality\"}. See docs in api.py\n",
|
|
"preset = \"fast\" #@param [\"ultra_fast\", \"fast\", \"standard\", \"high_quality\"]"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "9413f553-5bd0-4820-bad4-edd7fd7d2370",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"%ls ../TTS/tts/utils/assets/tortoise/voices/\n",
|
|
"import IPython\n",
|
|
"IPython.display.Audio(filename='../TTS/tts/utils/assets/tortoise/voices/lj/1.wav')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "96a98ae5-313b-40d1-9311-5a785f2c9a4e",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"#@markdown Pick one of the voices from the output above\n",
|
|
"voice = 'lj' #@param {type:\"string\"}\n",
|
|
"\n",
|
|
"#@markdown Load it and send it through Tortoise.\n",
|
|
"voice_samples, conditioning_latents = load_voice(voice)\n",
|
|
"gen = tts.tts_with_preset(text, voice_samples=voice_samples, conditioning_latents=conditioning_latents, \n",
|
|
" preset=preset)\n",
|
|
"torchaudio.save('generated.wav', gen.squeeze(0).cpu(), 24000)\n",
|
|
"IPython.display.Audio('generated.wav')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "04e473e5-c489-4a78-aa11-03e89a778ed8",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.8.16"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|