From 7e686c3c5a33f1df6f111cdc7a258e5b67614799 Mon Sep 17 00:00:00 2001 From: MarkBase Admin Date: Mon, 6 Jul 2026 01:01:43 +0800 Subject: [PATCH] v2: add long context 12B test (256 tokens) --- Tests/01_Model/LongContext12BTest.swift | 56 +++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Tests/01_Model/LongContext12BTest.swift diff --git a/Tests/01_Model/LongContext12BTest.swift b/Tests/01_Model/LongContext12BTest.swift new file mode 100644 index 0000000..4d47e78 --- /dev/null +++ b/Tests/01_Model/LongContext12BTest.swift @@ -0,0 +1,56 @@ +import XCTest +@testable import MarkBase + +final class LongContext12BTest: XCTestCase { + + var engine: MarkBaseEngine! + var model: E4BModel! + let modelDir = "/Users/accusys/MarkBaseEngine/models/gemma-4-12b-it-4bit" + let maxCtx = 2048 + + override func setUp() { + super.setUp() + guard FileManager.default.fileExists(atPath: modelDir + "/model.safetensors.index.json") else { + return + } + engine = try? MarkBaseEngine(autoCompile: true) + model = try? E4BModel(modelDir: modelDir, engine: engine, maxContextLength: maxCtx) + } + + func testLongContext256Tokens() throws { + try XCTSkipIf(model == nil, "12B model not found") + + let promptLength = 256 + var tokens = [Int]() + for i in 0.. maxVal { maxVal = logits[j]; maxIdx = j } + } + genTokens.append(maxIdx) + print(" gen[\(i)]: token=\(maxIdx) logit=\(maxVal)") + } + } +}