Cannot load this model in Swift

#4
by ekurutepe - opened

This is the first time I'm trying to load a CoreML model in a Swift app. So please bear with me.
I added the DistilBERT_fp16.mlpackage to my Xcode project and then tried to initialize a copy of the model with the following code:

        do {
            return try DistilBERT_fp16(configuration: .init())
        } catch {
            print("Error: \(error)")
            return nil
        }

This snippet fails with the following errors:

E5RT encountered an STL exception. msg = Espresso exception: "Invalid state": MpsGraph backend validation on incompatible OS.
E5RT: Espresso exception: "Invalid state": MpsGraph backend validation on incompatible OS (11)
[Espresso::handle_ex_] exception=Espresso compiled without MPSGraph engine.
Failure translating MIL->EIR network: Espresso exception: "Invalid state": Provided weight file is not of blob_v1 format.
[Espresso::handle_ex_plan] exception=Espresso exception: "Invalid state": Provided weight file is not of blob_v1 format. status=-5

Error: Error Domain=com.apple.CoreML Code=0 "Failed to build the model execution plan using a model architecture file '<path-to-app-bundle>/DistilBERT_fp16.mlmodelc/model.mil' with error code: -5." UserInfo={NSLocalizedDescription=Failed to build the model execution plan using a model architecture file '<path-to-app-bundle>/DistilBERT_fp16.mlmodelc/model.mil' with error code: -5.}
Error: Error Domain=Bert Code=0 "Failed to load model" UserInfo={NSLocalizedDescription=Failed to load model}

Am I doing something wrong?

Ok, I'm a dummy. Forgot to pull the weights from LFS. Now that they are here, everything works as expected.

ekurutepe changed discussion status to closed

Sign up or log in to comment