Skip to content

Commit b29544e

Browse files
neverbiasuneverbiasu
and
neverbiasu
authored
doc: revise the Load Models part of examples/ipynb (#397)
Co-authored-by: neverbiasu <neverbiasu@outlook.com>
1 parent a851b9a commit b29544e

File tree

2 files changed

+126
-23
lines changed

2 files changed

+126
-23
lines changed

examples/ipynb/colab.ipynb

Lines changed: 68 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"source": [
6-
"## Clone Repo"
7-
],
85
"metadata": {
96
"id": "xYJFXKP9xhQM"
10-
}
7+
},
8+
"source": [
9+
"## Clone Repo"
10+
]
1111
},
1212
{
1313
"cell_type": "code",
@@ -26,12 +26,12 @@
2626
},
2727
{
2828
"cell_type": "markdown",
29-
"source": [
30-
"## Import Libs"
31-
],
3229
"metadata": {
3330
"id": "zdzEFoknxqTH"
34-
}
31+
},
32+
"source": [
33+
"## Import Libs"
34+
]
3535
},
3636
{
3737
"cell_type": "code",
@@ -70,13 +70,65 @@
7070
},
7171
"outputs": [],
7272
"source": [
73-
"chat = ChatTTS.Chat()\n",
74-
"\n",
75-
"# Use force_redownload=True if the weights updated.\n",
76-
"chat.load_models(source = 'huggingface')\n",
77-
"\n",
78-
"# If you download the weights manually, set source='custom'.\n",
79-
"# chat.load_models(source='custom', custom_path='YOUR CUSTOM PATH')"
73+
"chat = ChatTTS.Chat()"
74+
]
75+
},
76+
{
77+
"cell_type": "markdown",
78+
"metadata": {},
79+
"source": [
80+
"### Here are three choices for loading models:"
81+
]
82+
},
83+
{
84+
"cell_type": "markdown",
85+
"metadata": {},
86+
"source": [
87+
"#### 1. Load models from Hugging Face:"
88+
]
89+
},
90+
{
91+
"cell_type": "code",
92+
"execution_count": null,
93+
"metadata": {},
94+
"outputs": [],
95+
"source": [
96+
"# use force_redownload=True if the weights have been updated.\n",
97+
"chat.load_models(source='huggingface', force_redownload=True)"
98+
]
99+
},
100+
{
101+
"cell_type": "markdown",
102+
"metadata": {},
103+
"source": [
104+
"#### 2. Load models from local directories 'asset' and 'config':"
105+
]
106+
},
107+
{
108+
"cell_type": "code",
109+
"execution_count": null,
110+
"metadata": {},
111+
"outputs": [],
112+
"source": [
113+
"chat.load_models()\n",
114+
"# chat.load_models(source='local') same as above"
115+
]
116+
},
117+
{
118+
"cell_type": "markdown",
119+
"metadata": {},
120+
"source": [
121+
"#### 3. Load models from a custom path:"
122+
]
123+
},
124+
{
125+
"cell_type": "code",
126+
"execution_count": null,
127+
"metadata": {},
128+
"outputs": [],
129+
"source": [
130+
"# write the model path into custom_path\n",
131+
"chat.load_models(source='custom', custom_path='YOUR CUSTOM PATH')"
80132
]
81133
},
82134
{
@@ -352,4 +404,4 @@
352404
},
353405
"nbformat": 4,
354406
"nbformat_minor": 0
355-
}
407+
}

examples/ipynb/example.ipynb

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,65 @@
5151
"source": [
5252
"os.chdir(root_dir)\n",
5353
"\n",
54-
"chat = ChatTTS.Chat()\n",
54+
"chat = ChatTTS.Chat()"
55+
]
56+
},
57+
{
58+
"cell_type": "markdown",
59+
"metadata": {},
60+
"source": [
61+
"### Here are three choices for loading models:"
62+
]
63+
},
64+
{
65+
"cell_type": "markdown",
66+
"metadata": {},
67+
"source": [
68+
"#### 1. Load models from Hugging Face:"
69+
]
70+
},
71+
{
72+
"cell_type": "code",
73+
"execution_count": null,
74+
"metadata": {},
75+
"outputs": [],
76+
"source": [
77+
"# use force_redownload=True if the weights have been updated.\n",
78+
"chat.load_models(source='huggingface', force_redownload=True)"
79+
]
80+
},
81+
{
82+
"cell_type": "markdown",
83+
"metadata": {},
84+
"source": [
85+
"#### 2. Load models from local directories 'asset' and 'config':"
86+
]
87+
},
88+
{
89+
"cell_type": "code",
90+
"execution_count": null,
91+
"metadata": {},
92+
"outputs": [],
93+
"source": [
5594
"chat.load_models()\n",
56-
"\n",
57-
"# Use force_redownload=True if the weights updated.\n",
58-
"# chat.load_models(force_redownload=True)\n",
59-
"\n",
60-
"# If you download the weights manually, set source='locals'.\n",
61-
"# chat.load_models(source='local', local_path='YOUR LOCAL PATH')"
95+
"# chat.load_models(source='local') same as above"
96+
]
97+
},
98+
{
99+
"cell_type": "markdown",
100+
"metadata": {},
101+
"source": [
102+
"#### 3. Load models from a custom path:"
103+
]
104+
},
105+
{
106+
"cell_type": "code",
107+
"execution_count": null,
108+
"metadata": {},
109+
"outputs": [],
110+
"source": [
111+
"# write the model path into custom_path\n",
112+
"chat.load_models(source='custom', custom_path='YOUR CUSTOM PATH')"
62113
]
63114
},
64115
{

0 commit comments

Comments
 (0)