Initial commit: E4B-MarkBase model integration with passing tests
CI / build-and-test (push) Has been cancelled
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
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import XCTest
|
||||
@testable import MarkBase
|
||||
|
||||
class MinimalTextLayerTest: XCTestCase {
|
||||
|
||||
func testMinimalTextLayer() throws {
|
||||
print("\n═══════════════════════════════════════════════════════════════════")
|
||||
print(" Minimal TEXT Layer Test")
|
||||
print("═══════════════════════════════════════════════════════════════════\n")
|
||||
|
||||
let modelPath = "/Users/accusys/MarkBaseEngine/models/gemma-4-e2b-it-4bit"
|
||||
|
||||
guard FileManager.default.fileExists(atPath: modelPath) else {
|
||||
print("⚠ Model not found at \(modelPath), skipping")
|
||||
return
|
||||
}
|
||||
|
||||
let engine = try MarkBaseEngine(autoCompile: true)
|
||||
|
||||
// Load model
|
||||
print("Loading E4B model...")
|
||||
let model = try E4BModel(modelDir: modelPath, engine: engine, maxContextLength: 128)
|
||||
print("✓ Model loaded")
|
||||
print(" Layers: \(model.numHiddenLayers)")
|
||||
print(" Hidden: \(model.hiddenSize)")
|
||||
print(" Vocab: \(model.vocabSize)")
|
||||
|
||||
// Test forward pass with debug
|
||||
print("\nTesting forward pass...")
|
||||
let tokenId: UInt32 = 2 // BOS token
|
||||
let result = try model.forwardOptimized(tokenId: Int(tokenId), position: 0)
|
||||
|
||||
print("Forward result sample: \(result.prefix(10))")
|
||||
let nanCount = result.filter { $0.isNaN }.count
|
||||
print("NaN count: \(nanCount)/\(result.count)")
|
||||
|
||||
if nanCount > 0 {
|
||||
print("✗ Forward pass produced NaN!")
|
||||
} else {
|
||||
print("✓ Forward pass OK")
|
||||
}
|
||||
|
||||
print("\n═══════════════════════════════════════════════════════════════════")
|
||||
print(" Test completed")
|
||||
print("═══════════════════════════════════════════════════════════════════\n")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user