Skip to content

Commit 7227be9

Browse files
committed
Fix: asset download models
1 parent 1528c33 commit 7227be9

File tree

6 files changed

+8
-34
lines changed

6 files changed

+8
-34
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ poetry.lock
2121
docs
2222
static/wavs/*
2323
examples
24-
ffmpeg/ffmpeg.exe
24+
ffmpeg/ffmpeg.exe
25+
asset/

ChatTTS/utils/dl.py

+2
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,14 @@ def download_all_assets(tmpdir: str, version="0.2.6"):
130130
suffix = "zip" if is_win else "tar.gz"
131131
RVCMD_URL = BASE_URL + f"v{version}/rvcmd_{system_type}_{architecture}.{suffix}"
132132
cmdfile = os.path.join(tmpdir, "rvcmd")
133+
print(f'{RVCMD_URL=},{tmpdir=}')
133134
if is_win:
134135
download_and_extract_zip(RVCMD_URL, tmpdir)
135136
cmdfile += ".exe"
136137
else:
137138
download_and_extract_tar_gz(RVCMD_URL, tmpdir)
138139
os.chmod(cmdfile, 0o755)
140+
print(f'{cmdfile=}')
139141
subprocess.run([cmdfile, "-notui", "-w", "0", "assets/chtts"])
140142
except Exception:
141143
BASE_URL = "https://raw.gitcode.com/u011570312/RVC-Models-Downloader/assets/"

app.py

+2-31
Original file line numberDiff line numberDiff line change
@@ -50,41 +50,12 @@
5050
print('请先安装ffmpeg')
5151
time.sleep(60)
5252
exit()
53-
CHATTTS_DIR= MODEL_DIR+'/pzc163/chatTTS'
54-
# 默认从 modelscope 下载模型
55-
# 如果已存在则不再下载和检测更新,便于离线内网使用
56-
if not os.path.exists(CHATTTS_DIR+"/config/path.yaml") and not os.path.exists(MODEL_DIR+'/models--2Noise--ChatTTS'):
57-
# 可连接modelscope
58-
if modelscope_status():
59-
print('modelscope ok')
60-
snapshot_download('pzc163/chatTTS',cache_dir=MODEL_DIR)
61-
else:
62-
print('from huggingface')
63-
CHATTTS_DIR=MODEL_DIR+'/models--2Noise--ChatTTS'
64-
import huggingface_hub
65-
os.environ['HF_HUB_CACHE']=MODEL_DIR
66-
os.environ['HF_ASSETS_CACHE']=MODEL_DIR
67-
huggingface_hub.snapshot_download(cache_dir=MODEL_DIR,repo_id="2Noise/ChatTTS", allow_patterns=["*.pt", "*.yaml"])
68-
53+
6954

7055
chat = ChatTTS.Chat()
7156
device=os.getenv('device','default')
72-
chat.load(source="custom",custom_path=CHATTTS_DIR, device=None if device=='default' else device,compile=True if os.getenv('compile','true').lower()!='false' else False)
73-
74-
75-
76-
7757

78-
# 如果希望从 huggingface.co下载模型,将以下注释删掉。将上方3行内容注释掉
79-
# 如果已存在则不再下载和检测更新,便于离线内网使用
80-
#CHATTTS_DIR=MODEL_DIR+'/models--2Noise--ChatTTS'
81-
#if not os.path.exists(CHATTTS_DIR):
82-
#import huggingface_hub
83-
#os.environ['HF_HUB_CACHE']=MODEL_DIR
84-
#os.environ['HF_ASSETS_CACHE']=MODEL_DIR
85-
#huggingface_hub.snapshot_download(cache_dir=MODEL_DIR,repo_id="2Noise/ChatTTS", allow_patterns=["*.pt", "*.yaml"])
86-
# chat = ChatTTS.Chat()
87-
# chat.load(source="local",local_path=CHATTTS_DIR, compile=True if os.getenv('compile','true').lower()!='false' else False)
58+
chat.load(source="local" if not os.path.exists(MODEL_DIR+"/DVAE_full.pt") else 'custom',custom_path=ROOT_DIR, device=None if device=='default' else device,compile=True if os.getenv('compile','true').lower()!='false' else False)
8859

8960

9061
# 配置日志

speaker/seed_2193_restored_emb.pt

4.15 KB
Binary file not shown.

uilib/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION='0.99'
1+
VERSION='1.0'

uilib/cfg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def get_executable_path():
1212

1313
ROOT_DIR=get_executable_path()
1414

15-
MODEL_DIR_PATH=Path(ROOT_DIR+"/models")
15+
MODEL_DIR_PATH=Path(ROOT_DIR+"/asset")
1616
MODEL_DIR_PATH.mkdir(parents=True, exist_ok=True)
1717
MODEL_DIR=MODEL_DIR_PATH.as_posix()
1818

0 commit comments

Comments
 (0)