Explorar o código

Model: resume download (#220)

* Automatically download models

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix

* Ensure mirror enabled

* no_proxy before mirror

* resume download

* Remove old starter

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
spicysama hai 1 ano
pai
achega
ac9fd1489a
Modificáronse 2 ficheiros con 10 adicións e 20 borrados
  1. 0 12
      start_old.bat
  2. 10 8
      tools/download_models.py

+ 0 - 12
start_old.bat

@@ -1,12 +0,0 @@
-@echo off
-chcp 65001
-echo loading page...
-set PYTHONPATH=%~dp0
-set no_proxy="localhost, 127.0.0.1, 0.0.0.0"
-set HF_ENDPOINT="https://hf-mirror.com"
-
-if exist ".\fishenv\" (
-    .\fishenv\python fish_speech\webui\manage.py
-) else (
-    python fish_speech\webui\manage.py
-)

+ 10 - 8
tools/download_models.py

@@ -17,20 +17,21 @@ files = [
 
 # Hugging Face 仓库信息
 repo_id = "fishaudio/fish-speech-1"
-cache_dir = "./checkpoints"
+local_dir = "./checkpoints"
 
 
-os.makedirs(cache_dir, exist_ok=True)
+os.makedirs(local_dir, exist_ok=True)
 
 # 检查每个文件是否存在,如果不存在则从 Hugging Face 仓库下载
 for file in files:
-    file_path = os.path.join(cache_dir, file)
+    file_path = os.path.join(local_dir, file)
     if not os.path.exists(file_path):
         print(f"{file} 不存在,从 Hugging Face 仓库下载...")
         hf_hub_download(
             repo_id=repo_id,
             filename=file,
-            cache_dir=cache_dir,
+            resume_download=True,
+            local_dir=local_dir,
             local_dir_use_symlinks=False,
         )
     else:
@@ -44,17 +45,18 @@ files = [
 
 # Hugging Face 仓库信息
 repo_id = "SpicyqSama007/fish-speech-packed"
-cache_dir = ".cache/whisper"
-os.makedirs(cache_dir, exist_ok=True)
+local_dir = ".cache/whisper"
+os.makedirs(local_dir, exist_ok=True)
 
 for file in files:
-    file_path = os.path.join(cache_dir, file)
+    file_path = os.path.join(local_dir, file)
     if not os.path.exists(file_path):
         print(f"{file} 不存在,从 Hugging Face 仓库下载...")
         hf_hub_download(
             repo_id=repo_id,
             filename=file,
-            cache_dir=cache_dir,
+            resume_download=True,
+            local_dir=local_dir,
             local_dir_use_symlinks=False,
         )
     else: