Skip to content

Commit

Permalink
refactor: Chat.load_model to Chat.load (2noise#432)
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama authored Jun 24, 2024
1 parent e08fd43 commit 5222976
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ChatTTS/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def download_models(

return download_path

def load_models(
def load(
self,
source: Literal['huggingface', 'local', 'custom']='local',
force_redownload=False,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ from IPython.display import Audio
import torchaudio

chat = ChatTTS.Chat()
chat.load_models(compile=False) # Set to True for better performance
chat.load(compile=False) # Set to True for better performance

texts = ["PUT YOUR TEXT HERE",]

Expand Down
2 changes: 1 addition & 1 deletion docs/cn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ from IPython.display import Audio
import torchaudio

chat = ChatTTS.Chat()
chat.load_models(compile=False) # Set to True for better performance
chat.load(compile=False) # Set to True for better performance

texts = ["PUT YOUR TEXT HERE",]

Expand Down
2 changes: 1 addition & 1 deletion docs/jp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import ChatTTS
from IPython.display import Audio

chat = ChatTTS.Chat()
chat.load_models(compile=False) # より良いパフォーマンスのためにTrueに設定
chat.load(compile=False) # より良いパフォーマンスのためにTrueに設定

texts = ["ここにテキストを入力してください",]

Expand Down
2 changes: 1 addition & 1 deletion docs/ru/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import ChatTTS
from IPython.display import Audio

chat = ChatTTS.Chat()
chat.load_models(compile=False) # Установите значение True для лучшей производительности
chat.load(compile=False) # Установите значение True для лучшей производительности

texts = ["ВВЕДИТЕ ВАШ ТЕКСТ ЗДЕСЬ",]

Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def main(texts: list[str]):

chat = ChatTTS.Chat(get_logger("ChatTTS"))
logger.info("Initializing ChatTTS...")
if chat.load_models():
if chat.load():
logger.info("Models loaded successfully.")
else:
logger.error("Models load failed.")
Expand Down
8 changes: 4 additions & 4 deletions examples/ipynb/colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"outputs": [],
"source": [
"# use force_redownload=True if the weights have been updated.\n",
"chat.load_models(source='huggingface', force_redownload=True)"
"chat.load(source='huggingface', force_redownload=True)"
]
},
{
Expand All @@ -143,8 +143,8 @@
},
"outputs": [],
"source": [
"chat.load_models()\n",
"# chat.load_models(source='local') same as above"
"chat.load()\n",
"# chat.load(source='local') same as above"
]
},
{
Expand All @@ -165,7 +165,7 @@
"outputs": [],
"source": [
"# write the model path into custom_path\n",
"chat.load_models(source='custom', custom_path='YOUR CUSTOM PATH')"
"chat.load(source='custom', custom_path='YOUR CUSTOM PATH')"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions examples/ipynb/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"outputs": [],
"source": [
"# use force_redownload=True if the weights have been updated.\n",
"chat.load_models(source='huggingface', force_redownload=True)"
"chat.load(source='huggingface', force_redownload=True)"
]
},
{
Expand All @@ -114,8 +114,8 @@
"metadata": {},
"outputs": [],
"source": [
"chat.load_models()\n",
"# chat.load_models(source='local') same as above"
"chat.load()\n",
"# chat.load(source='local') same as above"
]
},
{
Expand All @@ -132,7 +132,7 @@
"outputs": [],
"source": [
"# write the model path into custom_path\n",
"chat.load_models(source='custom', custom_path='YOUR CUSTOM PATH')"
"chat.load(source='custom', custom_path='YOUR CUSTOM PATH')"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions examples/web/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def on_voice_change(vocie_selection):

def load_chat(cust_path: Optional[str], coef: Optional[str]) -> bool:
if cust_path == None:
ret = chat.load_models(coef=coef, compile=sys.platform != 'win32')
ret = chat.load(coef=coef, compile=sys.platform != 'win32')
else:
logger.info('local model path: %s', cust_path)
ret = chat.load_models('custom', custom_path=cust_path, coef=coef, compile=sys.platform != 'win32')
ret = chat.load('custom', custom_path=cust_path, coef=coef, compile=sys.platform != 'win32')
global custom_path
custom_path = cust_path
if ret:
Expand Down

0 comments on commit 5222976

Please sign in to comment.