#!/usr/bin/env swift import Foundation print("=== Test 26B Standard Model Loading ===") print("Start time: \(Date())") fflush(stdout) do { // Load config let modelDir = "/Users/accusys/MarkBaseEngine/models/gemma-4-26b-standard" let configURL = URL(fileURLWithPath: modelDir).appendingPathComponent("config.json") guard FileManager.default.fileExists(atPath: configURL.path) else { print("ERROR: Config not found at \(configURL.path)") exit(1) } print("Loading config from \(configURL.path)") fflush(stdout) let configData = try Data(contentsOf: configURL) let config = try JSONDecoder().decode([String: Value].self, from: configData) print("Config loaded, keys: \(config.keys.sorted())") fflush(stdout) print("Creating engine...") fflush(stdout) // We can't easily create E4BEngine here without importing the module // So let's just test config loading for now print("Test completed successfully!") } catch { print("ERROR: \(error)") exit(1) } enum Value: Codable { case string(String) case int(Int) case double(Double) case bool(Bool) case array([Value]) case dictionary([String: Value]) init(from decoder: Decoder) throws { let container = try decoder.singleValueContainer() if let value = try? container.decode(String.self) { self = .string(value) } else if let value = try? container.decode(Int.self) { self = .int(value) } else if let value = try? container.decode(Double.self) { self = .double(value) } else if let value = try? container.decode(Bool.self) { self = .bool(value) } else if let value = try? container.decode([Value].self) { self = .array(value) } else if let value = try? container.decode([String: Value].self) { self = .dictionary(value) } else { throw DecodingError.dataCorruptedError(in: container, debugDescription: "Unknown value type") } } func encode(to encoder: Encoder) throws { var container = encoder.singleValueContainer() switch self { case .string(let value): try container.encode(value) case .int(let value): try container.encode(value) case .double(let value): try container.encode(value) case .bool(let value): try container.encode(value) case .array(let value): try container.encode(value) case .dictionary(let value): try container.encode(value) } } }