将 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>
48 lines
1.5 KiB
Swift
48 lines
1.5 KiB
Swift
import Testing
|
|
import Foundation
|
|
@testable import 康康
|
|
|
|
struct ModelManifestTests {
|
|
|
|
@Test func llmHasTenFunctionalFiles() {
|
|
#expect(ModelManifest.files(for: .llm).count == 10)
|
|
}
|
|
|
|
@Test func vlHasFourteenFunctionalFiles() {
|
|
#expect(ModelManifest.files(for: .vl).count == 14)
|
|
}
|
|
|
|
@Test func llmTotalBytesMatchesManifest() {
|
|
#expect(ModelManifest.totalBytes(for: .llm) == 1_749_079_691)
|
|
}
|
|
|
|
@Test func vlTotalBytesMatchesManifest() {
|
|
#expect(ModelManifest.totalBytes(for: .vl) == 3_109_729_929)
|
|
}
|
|
|
|
@Test func excludesReadmeAndGitattributes() {
|
|
for kind in [ModelKind.llm, .vl] {
|
|
let names = ModelManifest.files(for: kind).map(\.path)
|
|
#expect(!names.contains("README.md"))
|
|
#expect(!names.contains(".gitattributes"))
|
|
}
|
|
}
|
|
|
|
@Test func includesEssentialFiles() {
|
|
let llm = ModelManifest.files(for: .llm).map(\.path)
|
|
#expect(llm.contains("config.json"))
|
|
#expect(llm.contains("model.safetensors"))
|
|
#expect(llm.contains("tokenizer.json"))
|
|
|
|
let vl = ModelManifest.files(for: .vl).map(\.path)
|
|
#expect(vl.contains("preprocessor_config.json")) // VL 拍照识别必需
|
|
#expect(vl.contains("model.safetensors"))
|
|
}
|
|
|
|
@Test func fileURLIsBaseSlashRepoSlashPath() {
|
|
let file = ModelFile(path: "config.json", bytes: 3_113)
|
|
let url = ModelManifest.fileURL(for: .llm, file: file)
|
|
#expect(url.absoluteString == "https://file.myv0.com/Qwen3.5-2B-4bit/config.json")
|
|
}
|
|
}
|