mlx-swift-examples
mlx-swift-examples copied to clipboard
Error: Unsupported model type: gemma3n
If I try to use gemma-3n model using swift-mlx-examples package I get following error:
Error: Unsupported model type: gemma3n
I installed the package and run the code with below simple code. It all worked well with different version of model such as SmolLM-135M-Instruct-4bit but keep failing when I try to use mlx-community/gemma-3n-E2B-it-lm-bf16 or mlx-community/gemma-3n-E4B-it-lm-bf16
import SwiftUI
import MLXVLM
import MLXLMCommon
struct ContentView: View {
@State private var isLoading = false
var body: some View {
VStack(spacing: 20) {
if isLoading {
ProgressView("Processing...")
}
Button("Process") {
Task {
await process()
}
}
.padding()
}
.padding()
}
func process() async {
isLoading = true
defer { isLoading = false }
do {
let model = try await loadModel(id: "mlx-community/SmolLM-135M-Instruct-4bit")
let session = ChatSession(model)
print(try await session.respond(to: "What are two things to see in San Francisco?"))
} catch {
print("Error: \(error.localizedDescription)")
}
}
}