Skip to content

Error: Unsupported model type: gemma3n #25

@seungjun-green

Description

@seungjun-green

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)")
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions