File size: 6,091 Bytes
79f9f38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/bin/bash

# 提示用户选择下载方式
echo "Please select a model download method:"
echo "请选择模型下载方式:"
echo "1. Download from ModelScope (No resuming capability)"
echo "1. 从 ModelScope 下载(有断点续传功能)推荐"
# 记得先下载modelscope, pip install modelscope
echo "记得先下载modelscope, pip install modelsope"
echo "2. Download from Huggingface (With resuming capability)"
echo "2. 从 Huggingface 下载(有断点续传功能)"
echo "3. Download from Huggingface mirror site (Possibly faster)"
echo "3. 从 Huggingface 镜像站点下载(镜像可能快一点)"
read -p "Enter 1, 2, or 3 to choose a download method: " download_option

# 下载模型
# Download the models
case $download_option in
  1)
    echo "Downloading models from ModelScope..."
    echo "正在从 ModelScope 下载模型..."
    python scripts/modelscope_download.py
    if [ $? -ne 0 ]; then
      echo "Failed to download models from ModelScope. Please check the scripts/modelscope_download.py script or your network connection."
      echo "从 ModelScope 下载模型失败,请检查脚本 scripts/modelscope_download.py 或网络连接。"
      exit 1
    fi
    ;;
  2)
    echo "Downloading models from Huggingface..."
    echo "正在从 Huggingface 下载模型..."
    python scripts/huggingface_download.py
    if [ $? -ne 0 ]; then
      echo "Failed to download models from Huggingface. Please check the scripts/huggingface_download.py script or your network connection."
      echo "从 Huggingface 下载模型失败,请检查脚本 scripts/huggingface_download.py 或网络连接。"
      exit 1
    fi
    ;;
  3)
    echo "Downloading models from Huggingface mirror site..."
    echo "正在从 Huggingface 镜像站点下载模型..."
    export HF_ENDPOINT=https://hf-mirror.com
    huggingface-cli download --resume-download --local-dir-use-symlinks False Kedreamix/Linly-Talker --local-dir Linly-Talker
    if [ $? -ne 0 ]; then
      echo "Failed to download models from Huggingface mirror site. Please check HF_ENDPOINT or your network connection."
      echo "从 Huggingface 镜像站点下载模型失败,请检查 HF_ENDPOINT 或网络连接。"
      exit 1
    fi
    ;;
  *)
    echo "Invalid selection. Please enter 1, 2, or 3."
    echo "无效选择,请输入 1, 2 或 3。"
    exit 1
    ;;
esac

echo "Model download completed."
echo "模型下载完成。"

# 检查并移动模型
# Check and move the models

# 2. 移动所有模型到当前目录
# Move all models to the current directory
if [ -d "Kedreamix/Linly-Talker/checkpoints" ]; then
  mv Kedreamix/Linly-Talker/checkpoints/* ./checkpoints
  if [ $? -ne 0 ]; then
    echo "Failed to move checkpoints."
    echo "移动 checkpoints 失败。"
    exit 1
  fi
else
  echo "Directory Kedreamix/Linly-Talker/checkpoints does not exist, cannot move checkpoints."
  echo "目录 Kedreamix/Linly-Talker/checkpoints 不存在,无法移动 checkpoints。"
  exit 1
fi

# 3. 若使用GFPGAN增强,安装对应的库
# If using GFPGAN enhancement, install the corresponding library
# pip install gfpgan

if [ -d "Kedreamix/Linly-Talker/gfpgan" ]; then
  mv Kedreamix/Linly-Talker/gfpgan ./
  if [ $? -ne 0 ]; then
    echo "Failed to move gfpgan directory."
    echo "移动 gfpgan 目录失败。"
    exit 1
  fi
else
  echo "Directory Kedreamix/Linly-Talker/gfpgan does not exist, cannot move gfpgan."
  echo "目录 Kedreamix/Linly-Talker/gfpgan 不存在,无法移动 gfpgan。"
  exit 1
fi

# 4. 语音克隆模型
# Voice cloning model
if [ -d "Kedreamix/Linly-Talker/GPT_SoVITS/pretrained_models" ]; then
  mv Kedreamix/Linly-Talker/GPT_SoVITS/pretrained_models/* ./GPT_SoVITS/pretrained_models/
  if [ $? -ne 0 ]; then
    echo "Failed to move GPT_SoVITS/pretrained_models."
    echo "移动 GPT_SoVITS/pretrained_models 失败。"
    exit 1
  fi
else
  echo "Directory Kedreamix/Linly-Talker/GPT_SoVITS/pretrained_models does not exist, cannot move pretrained models."
  echo "目录 Kedreamix/Linly-Talker/GPT_SoVITS/pretrained_models 不存在,无法移动预训练模型。"
  exit 1
fi

# 5. Qwen大模型
# Qwen model
if [ -d "Kedreamix/Linly-Talker/Qwen" ]; then
  mv Kedreamix/Linly-Talker/Qwen ./
  if [ $? -ne 0 ]; then
    echo "Failed to move Qwen directory."
    echo "移动 Qwen 目录失败。"
    exit 1
  fi
else
  echo "Directory Kedreamix/Linly-Talker/Qwen does not exist, cannot move Qwen model."
  echo "目录 Kedreamix/Linly-Talker/Qwen 不存在,无法移动 Qwen 模型。"
  exit 1
fi

# 6. MuseTalk模型
# MuseTalk model
mkdir -p ./Musetalk/models/
if [ -d "Kedreamix/Linly-Talker/MuseTalk" ]; then
  mv Kedreamix/Linly-Talker/MuseTalk/* ./Musetalk/models/
  if [ $? -ne 0 ]; then
    echo "Failed to move MuseTalk/models."
    echo "移动 MuseTalk/models 失败。"
    exit 1
  fi
else
  echo "Directory Kedreamix/Linly-Talker/MuseTalk does not exist, cannot move MuseTalk model."
  echo "目录 Kedreamix/Linly-Talker/MuseTalk 不存在,无法移动 MuseTalk 模型。"
  exit 1
fi

# 7. WhisperASR模型
# WhisperASR model
if [ -d "Kedreamix/Linly-Talker/Whisper" ]; then
  mv Kedreamix/Linly-Talker/Whisper ./
  if [ $? -ne 0 ]; then
    echo "Failed to move Whisper directory."
    echo "移动 Whisper 目录失败。"
    exit 1
  fi
else
  echo "Directory Kedreamix/Linly-Talker/Whisper does not exist, cannot move Whisper model."
  echo "目录 Kedreamix/Linly-Talker/Whisper 不存在,无法移动 Whisper 模型。"
  exit 1
fi

# 8. FunASR模型
# FunASR model
if [ -d "Kedreamix/Linly-Talker/FunASR" ]; then
  mv Kedreamix/Linly-Talker/FunASR ./
  if [ $? -ne 0 ]; then
    echo "Failed to move FunASR directory."
    echo "移动 FunASR 目录失败。"
    exit 1
  fi
else
  echo "Directory Kedreamix/Linly-Talker/FunASR does not exist, cannot move FunASR model."
  echo "目录 Kedreamix/Linly-Talker/FunASR 不存在,无法移动 FunASR 模型。"
  exit 1
fi

echo "All models have been successfully moved and

 are ready."
echo "所有模型已成功移动并准备就绪。"