
Issue with Ollama Model Download: Progress Reverting During Download
快速结论:该问题发生在 Ollama 下载模型期间,下载进度反复回退(revert),尤其是在下载到 10-12% 或 60% 左右时。优先排查网络连接稳定性,或使用 Ctrl+C 中断后重新 ollama pull 作为临时绕过方式。
问题场景
在 macOS 上运行 ollama run <model_name> 或 ollama pull <model_name> 下载模型时出现。受影响的模型包括 llava:7b、granite3.1-dense:8b、llama3.2:1b-instruct-q2_K 等任意模型。用户使用 Ollama 版本 0.5.7 或 0.5.7-1,在多种网络环境下均遇到该问题。
报错原文
time=2025-01-19T16:09:54.920+03:30 level=INFO source=download.go:370 msg="170370233dd5 part 11 stalled; retrying. If this persists, press ctrl-c to exit, then 'ollama pull' to find a faster connection."
原因分析
Ollama 下载部分(part)时,若连接超过 5 秒未收到数据,则判定为“stalled”(停滞),并触发重试。此超时限制在代码中硬编码为 5 秒(server/download.go:368)。当网络速度不稳定、磁盘写入缓慢(尤其是 SSD 在缓存写入时)或上游连接延迟时,容易触发此行为,导致下载进度回退。该问题已在多个 Issue 中报告(如 #8406, #8384, #8330, #8280),但官方尚未提供长期解决方案。
环境排查
- Ollama 版本:确认当前版本是否为 0.5.7 或更早版本。较新版本可能包含相关调整。
- 操作系统:在 macOS(Apple Silicon 或 Intel)上最常见,但 Windows/Linux 也可能遇到。
- 网络环境:测试不同网络(如切换 Wi-Fi / 有线 / 移动热点),确认问题是否依旧。
- 磁盘性能:检查 SSD 或 HDD 的写入速度与 I/O 负载,高负载时更容易触发。
解决步骤
- 临时手动重试:在下载速度下降后的 5 秒内按下
Ctrl+C中断进程,然后立即重新运行ollama pull <model-name>。这可以跳过停滞检测,继续未完成的下载。 - 使用脚本自动重试:创建一个循环脚本,在超时后自动重启下载。
- macOS/Linux (shell):
#!/bin/sh while true; do timeout 10s ollama pull <model-name> done根据网络速度调整
timeout值(例如 10 秒)。下载完成后按Ctrl+C退出。 - Windows (PowerShell):
while ($true) { $process = Start-Process -FilePath "ollama" -ArgumentList "pull <model-name>" -PassThru -NoNewWindow try { $process | Wait-Process -Timeout 10 -ErrorAction Stop if ($process.ExitCode -eq 0) { break } } catch { $process | Stop-Process -Force -ErrorAction SilentlyContinue } Start-Sleep -Seconds 2 }
- macOS/Linux (shell):
- 排查网络稳定性:如果使用脚本经常超时,考虑更换为更稳定的网络连接,或联系 ISP 解决问题。
- 关注官方更新:由于该问题已标记为
bug和networking,建议关注 Ollama 后续版本中可能增加的可配置超时时间(如 60 秒)。
验证方法
成功运行 ollama run <model-name> 或 ollama pull <model-name> 且进度不出现回退,模型下载完成后可正常加载使用。如果使用脚本,确认脚本在模型下载完成后正确退出(或手动中断)。



