ac75faa0cc
CI / build-and-test (push) Has been cancelled
- E4B-MarkBase model (42 layers, 4.4GB) loaded successfully - All Phase 1-6 tests passed (model loading, forward pass, vision/audio towers, token generation, performance) - All stress tests passed (5/5 in 127.6s) - Concurrent inference - Memory stress (67.5 tok/s, 0 NaN) - Continuous generation - Batch processing - Long-running stability - Swift Metal inference engine with multimodal support
100 lines
3.2 KiB
Swift
100 lines
3.2 KiB
Swift
import XCTest
|
|
@testable import MarkBase
|
|
|
|
final class DebugTests: XCTestCase {
|
|
let model26BStdDir = "/Users/accusys/MarkBaseEngine/models/gemma-4-26b-standard"
|
|
|
|
func testSimplePrint() throws {
|
|
print("=== TEST STARTED ===")
|
|
fflush(stdout)
|
|
print("This is a simple test")
|
|
fflush(stdout)
|
|
print("=== TEST ENDING ===")
|
|
fflush(stdout)
|
|
XCTAssertTrue(true)
|
|
}
|
|
|
|
func testEngineCreation() throws {
|
|
print("=== TEST ENGINE CREATION STARTED ===")
|
|
fflush(stdout)
|
|
|
|
print("Creating engine...")
|
|
fflush(stdout)
|
|
|
|
let engine = try MarkBaseEngine(autoCompile: true)
|
|
|
|
print("Engine created successfully")
|
|
fflush(stdout)
|
|
print("=== TEST ENGINE CREATION ENDING ===")
|
|
fflush(stdout)
|
|
XCTAssertTrue(true)
|
|
}
|
|
|
|
func test26BStdModelLoad() throws {
|
|
print("=== TEST 26B STD MODEL LOAD STARTED ===")
|
|
fflush(stdout)
|
|
|
|
guard FileManager.default.fileExists(atPath: model26BStdDir + "/config.json") else {
|
|
print("Model not found, skipping")
|
|
return
|
|
}
|
|
|
|
print("Creating engine...")
|
|
fflush(stdout)
|
|
let engine = try MarkBaseEngine(autoCompile: true)
|
|
print("Engine created")
|
|
fflush(stdout)
|
|
|
|
print("Loading model...")
|
|
fflush(stdout)
|
|
let model = try E4BModel(modelDir: model26BStdDir, engine: engine, maxContextLength: 128)
|
|
print("Model loaded")
|
|
fflush(stdout)
|
|
|
|
print("=== TEST 26B STD MODEL LOAD ENDING ===")
|
|
fflush(stdout)
|
|
XCTAssertEqual(model.numHiddenLayers, 30)
|
|
}
|
|
|
|
func test26BStdForward() throws {
|
|
print("=== TEST 26B STD FORWARD STARTED ===")
|
|
fflush(stdout)
|
|
|
|
guard FileManager.default.fileExists(atPath: model26BStdDir + "/config.json") else {
|
|
print("Model not found, skipping")
|
|
return
|
|
}
|
|
|
|
let start = Date()
|
|
print("Creating engine...")
|
|
fflush(stdout)
|
|
let engine = try MarkBaseEngine(autoCompile: true)
|
|
print("Engine created in \(String(format: "%.1f", Date().timeIntervalSince(start)))s")
|
|
fflush(stdout)
|
|
|
|
print("Loading model...")
|
|
fflush(stdout)
|
|
let model = try E4BModel(modelDir: model26BStdDir, engine: engine, maxContextLength: 128)
|
|
let loadTime = Date().timeIntervalSince(start)
|
|
print("Model loaded in \(String(format: "%.1f", loadTime))s")
|
|
fflush(stdout)
|
|
|
|
print("Running forward pass...")
|
|
fflush(stdout)
|
|
let forwardStart = Date()
|
|
let logits = try model.forward(tokenId: 2, position: 0, debug: false)
|
|
let forwardTime = Date().timeIntervalSince(forwardStart)
|
|
print("Forward pass completed in \(String(format: "%.1f", forwardTime))s")
|
|
fflush(stdout)
|
|
|
|
let maxVal = logits.max()!
|
|
print("Logits max: \(maxVal)")
|
|
fflush(stdout)
|
|
|
|
XCTAssertFalse(maxVal.isNaN)
|
|
XCTAssertGreaterThan(maxVal, -1e6)
|
|
|
|
print("=== TEST 26B STD FORWARD ENDING ===")
|
|
fflush(stdout)
|
|
}
|
|
} |