Skip to content

Commit 4eb39eb

Browse files
author
Enols
committed
fix: use modelscope mirror for model downloads, remove proxy code
1 parent d949649 commit 4eb39eb

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src-tauri/src/modules/yolo/services/trainer.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,10 @@ impl TrainerService {
197197

198198
/// 获取所有可用的预训练模型列表
199199
///
200-
/// 使用 GitHub Raw URL(raw.githubusercontent.com)直接下载,不走 CDN 重定向,
201-
/// 代理(HTTP_PROXY/https_proxy)自动生效。
200+
/// 使用 ModelScope 国内镜像下载模型。
202201
/// 模型文件后缀统一为 .pt(与前端选型一致)。
203202
pub fn get_available_models() -> Vec<(&'static str, &'static str, String)> {
204-
let base = "https://raw.githubusercontent.com/ultralytics/assets/main/releases/download/v8.4.0";
203+
let base = "https://modelscope.cn/ultralytics/assets/releases/download/v8.4.0";
205204
vec![
206205
// YOLO11 检测模型
207206
("yolo11n", "检测", format!("{}/yolo11n.pt", base)),
@@ -297,11 +296,10 @@ impl TrainerService {
297296
}
298297
}
299298

300-
progress_callback(format!("正在从 GitHub 下载..."));
301-
302-
// 下载模型
299+
progress_callback(format!("正在从 ModelScope 镜像下载..."));
300+
303301
let client = reqwest::Client::builder()
304-
.timeout(std::time::Duration::from_secs(300)) // 5分钟超时
302+
.timeout(std::time::Duration::from_secs(300))
305303
.build()
306304
.map_err(|e| format!("创建HTTP客户端失败: {}", e))?;
307305

0 commit comments

Comments
 (0)