Skip to content

Commit

Permalink
doc: revise the Load Models part of examples/ipynb (#397)
Browse files Browse the repository at this point in the history
Co-authored-by: neverbiasu <[email protected]>
  • Loading branch information
neverbiasu and neverbiasu authored Jun 21, 2024
1 parent a851b9a commit b29544e
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 23 deletions.
84 changes: 68 additions & 16 deletions examples/ipynb/colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"cells": [
{
"cell_type": "markdown",
"source": [
"## Clone Repo"
],
"metadata": {
"id": "xYJFXKP9xhQM"
}
},
"source": [
"## Clone Repo"
]
},
{
"cell_type": "code",
Expand All @@ -26,12 +26,12 @@
},
{
"cell_type": "markdown",
"source": [
"## Import Libs"
],
"metadata": {
"id": "zdzEFoknxqTH"
}
},
"source": [
"## Import Libs"
]
},
{
"cell_type": "code",
Expand Down Expand Up @@ -70,13 +70,65 @@
},
"outputs": [],
"source": [
"chat = ChatTTS.Chat()\n",
"\n",
"# Use force_redownload=True if the weights updated.\n",
"chat.load_models(source = 'huggingface')\n",
"\n",
"# If you download the weights manually, set source='custom'.\n",
"# chat.load_models(source='custom', custom_path='YOUR CUSTOM PATH')"
"chat = ChatTTS.Chat()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Here are three choices for loading models:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 1. Load models from Hugging Face:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# use force_redownload=True if the weights have been updated.\n",
"chat.load_models(source='huggingface', force_redownload=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 2. Load models from local directories 'asset' and 'config':"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"chat.load_models()\n",
"# chat.load_models(source='local') same as above"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 3. Load models from a custom path:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# write the model path into custom_path\n",
"chat.load_models(source='custom', custom_path='YOUR CUSTOM PATH')"
]
},
{
Expand Down Expand Up @@ -352,4 +404,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
65 changes: 58 additions & 7 deletions examples/ipynb/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,65 @@
"source": [
"os.chdir(root_dir)\n",
"\n",
"chat = ChatTTS.Chat()\n",
"chat = ChatTTS.Chat()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Here are three choices for loading models:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 1. Load models from Hugging Face:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# use force_redownload=True if the weights have been updated.\n",
"chat.load_models(source='huggingface', force_redownload=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 2. Load models from local directories 'asset' and 'config':"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"chat.load_models()\n",
"\n",
"# Use force_redownload=True if the weights updated.\n",
"# chat.load_models(force_redownload=True)\n",
"\n",
"# If you download the weights manually, set source='locals'.\n",
"# chat.load_models(source='local', local_path='YOUR LOCAL PATH')"
"# chat.load_models(source='local') same as above"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 3. Load models from a custom path:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# write the model path into custom_path\n",
"chat.load_models(source='custom', custom_path='YOUR CUSTOM PATH')"
]
},
{
Expand Down

0 comments on commit b29544e

Please sign in to comment.