feat(AI): LLM 迁移到 mlx-swift-lm 2.31.3 + Qwen3.5-2B
将 SPM 依赖从 mlx-swift-examples 2.29.1 迁到改名延续仓库 mlx-swift-lm 2.31.3(含 qwen3_5 架构、旧 loadContainer API 兼容),文本 LLM 由 Qwen3-1.7B 换为 Qwen3.5-2B-4bit(走 qwen3_5→Qwen35Model 文本路径)。 连带 mlx-swift 0.29.1→0.31.4,顺修弃用 API: - MLX.GPU.clearCache() → MLX.Memory.clearCache() - MLX.GPU.set(cacheLimit:) → MLX.Memory.cacheLimit 更新 ModelManifest(.llm 文件清单+精确字节数,~1.63GiB)、ModelManifestTests、 HealthExport.modelTag 默认值。App BUILD SUCCEEDED + ModelManifestTests 通过。 保留作 MNN 改造的 GPU 兜底基线。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -74,7 +74,7 @@ actor AIRuntime {
|
||||
nonisolated static func configureMLXMemory() {
|
||||
#if !targetEnvironment(simulator)
|
||||
// 256MB cache 上限:够复用、不至于在 3GB 模型之上再囤几百 MB 空闲缓冲。
|
||||
MLX.GPU.set(cacheLimit: 256 * 1024 * 1024)
|
||||
MLX.Memory.cacheLimit = 256 * 1024 * 1024
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ actor AIRuntime {
|
||||
guard llmSession != nil else { return }
|
||||
llmSession = nil
|
||||
status = .notReady
|
||||
MLX.GPU.clearCache()
|
||||
MLX.Memory.clearCache()
|
||||
}
|
||||
|
||||
/// 卸载 VL,释放 ModelContainer 引用并清 MLX 显存缓存。幂等。
|
||||
@@ -216,7 +216,7 @@ actor AIRuntime {
|
||||
guard vlSession != nil else { return }
|
||||
vlSession = nil
|
||||
vlStatus = .notReady
|
||||
MLX.GPU.clearCache()
|
||||
MLX.Memory.clearCache()
|
||||
}
|
||||
|
||||
/// 图像 → JSON 字符串(由 VLPrompts.reportExtraction 引导)。
|
||||
|
||||
Reference in New Issue
Block a user