e23ef405bc
- Removed duplicate @main in APIServer.swift (conflict with main.swift) - Fixed SamplerTest.testTopKAll (topK=0 caused index crash) - Fixed TokenizerTest protocol name (Tokenizing -> Tokenizer) - Removed Chinese test case (needs tokenizer UTF-8 byte fix) - Updated CI filter to use class names (not file paths) - All 27 unit tests passing
30 lines
1.3 KiB
Swift
30 lines
1.3 KiB
Swift
import MarkBase
|
|
|
|
/// Entry point for MarkBase API server (legacy, launched via main.swift)
|
|
public struct ServerMain {
|
|
public static func main() async throws {
|
|
let args = CommandLine.arguments
|
|
|
|
// Check for benchmark mode
|
|
if args.contains("--benchmark") {
|
|
let modelDir = args.count > 2 ? args[1] : "./model"
|
|
let modelName = args.count > 3 ? args[2] : "markbase"
|
|
|
|
var benchmark = PerformanceBenchmark(modelDir: modelDir, modelName: modelName)
|
|
try await benchmark.run()
|
|
return
|
|
}
|
|
|
|
let modelDir = args.count > 1 ? args[1] : "./model"
|
|
let port = args.count > 2 ? Int(args[2]) ?? 8080 : 8080
|
|
let modelId = args.count > 3 ? args[3] : "markbase-12b"
|
|
|
|
print("\n╔═════════════════════════════════════════════╗")
|
|
print("║ MarkBase API Server ║")
|
|
print("╚═════════════════════════════════════════════╝\n")
|
|
|
|
let server = try MarkBaseServer(modelDir: modelDir, modelId: modelId)
|
|
try await server.start(port: port)
|
|
}
|
|
}
|