现场机 iPhone 17(A19/SME2)内存与加速均可承载 4B,质量优于 2B。 - ModelKind.mnnLLM rawValue → "Qwen3.5-4B-MNN",displayName → Qwen3.5-4B (MNN/SME2) - ModelManifest:7 个运行时文件(llm.mnn.weight ~2.45GB + 拆分的 visual.mnn.weight 188MB),总计 2,836,770,850 bytes(~2.64GiB) - ModelManifestTests:文件数 7 / 总字节 / URL 更新到 Qwen3.5-4B-MNN - CLAUDE.md §2:MNN 主模型记为 Qwen3.5-4B,MLX 兜底仍 2B 模拟器 ModelManifestTests TEST SUCCEEDED。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
70 lines
2.3 KiB
Swift
70 lines
2.3 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 mnnHasSevenFunctionalFiles() {
|
|
#expect(ModelManifest.files(for: .mnnLLM).count == 7)
|
|
}
|
|
|
|
@Test func mnnTotalBytesMatchesManifest() {
|
|
#expect(ModelManifest.totalBytes(for: .mnnLLM) == 2_836_770_850)
|
|
}
|
|
|
|
@Test func mnnHasEssentialRuntimeFiles() {
|
|
let names = ModelManifest.files(for: .mnnLLM).map(\.path)
|
|
#expect(names.contains("config.json"))
|
|
#expect(names.contains("llm.mnn"))
|
|
#expect(names.contains("llm.mnn.weight"))
|
|
#expect(names.contains("tokenizer.txt"))
|
|
}
|
|
|
|
@Test func mnnFileURLUsesRepoPath() {
|
|
let file = ModelFile(path: "config.json", bytes: 652)
|
|
let url = ModelManifest.fileURL(for: .mnnLLM, file: file)
|
|
#expect(url.absoluteString == "https://file.myv0.com/Qwen3.5-4B-MNN/config.json")
|
|
}
|
|
|
|
@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")
|
|
}
|
|
}
|