DenisovAV / flutter_gemma

The Flutter plugin allows running the Gemma AI model locally on a device from a Flutter application.
MIT License
32 stars 9 forks source link

Failed to build iOS app #5

Open edenko opened 4 months ago

edenko commented 4 months ago

image

Is there another way? I added the settings to the main, but what am I missing?


import Foundation import MediaPipeTasksGenAI

final class InferenceModel { private var inference: LlmInference!

init(maxTokens: Int, temperature: Float, randomSeed: Int, topK: Int) {
    let fileManager = FileManager.default
    let documentDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first!
    let filePath = documentDirectory.appendingPathComponent("model.bin").path

    do {
        let llmOptions = LlmInference.Options(modelPath: filePath)
        llmOptions.maxTokens = maxTokens
        llmOptions.temperature = temperature
        llmOptions.randomSeed = randomSeed
        llmOptions.topk = topK
        self.inference = try LlmInference(options: llmOptions)
    } catch {
        print("Failed to initialize LlmInference: \(error)")
    }
}

func generateResponse(prompt: String) throws -> String {
    return try inference.generateResponse(inputText: prompt)
}

func generateResponseAsync(prompt: String, progress: @escaping (_ partialResponse: String?, _ error: Error?) -> Void, completion: @escaping (() -> Void)) throws {
    do {
        try inference.generateResponseAsync(inputText: prompt, progress: progress, completion: completion)
    } catch {
        throw error
    }
}

}

This is a build

DenisovAV commented 4 months ago

Do you run an example or your own project? Could you tell me your XCode and MacOS versions? I have no such error.

edenko commented 4 months ago

I am running my own project. My Xcode version is 15.4 (15F31d) and macOS version is 14.1.2.

hypen-flutter commented 3 weeks ago

Same issue. Mac 15.0, Xcode 16.0