2

I receive the following runtime error in Watchkit extension during initial read of classifier file (.mlmodel):

"WatchKit App Extension[441:999198] [espresso] [Espresso::handle_ex_] exception=Unsupported engine type"

I thought it was a version issue with ML so I upgraded from Xcode 10.13 to 11 and still get the same error. I only started receiving this error when I moved my ML code from iPhone's ViewController to Watchkit Extension iWatch's InterfaceController.

I also notice that the auto-generated classifier (.mlmodel) file has different supported device versions in different sections, why would this be? Also, I am now running MacOS Catalina Beta (10.15), but this error was also occurring before the Beta upgrade of both MacOS and Xcode 10.14.

@available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) @available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *)

A portion of my auto-generated "GestureClassifier.mlmodel" file where it appears to produce the error and where it also shows two of the "@available" version differences below:

/// Class for model loading and prediction
@available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)
class GestureClassifier {
    var model: MLModel

/// URL of model assuming it was installed in the same bundle as this class
    class var urlOfModelInThisBundle : URL {
        let bundle = Bundle(for: GestureClassifier.self)
        return bundle.url(forResource: "GestureClassifier", withExtension:"mlmodelc")!
    }

    /**
        Construct a model with explicit path to mlmodelc file
        - parameters:
           - url: the file url of the model
           - throws: an NSError object that describes the problem
    */
    init(contentsOf url: URL) throws {
        self.model = try MLModel(contentsOf: url)
    }

    /// Construct a model that automatically loads the model from the app's bundle
    convenience init() {
        try! self.init(contentsOf: type(of:self).urlOfModelInThisBundle)
    }

    /**
        Construct a model with configuration
        - parameters:
           - configuration: the desired model configuration
           - throws: an NSError object that describes the problem
    */
    @available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *)
    convenience init(configuration: MLModelConfiguration) throws {
        try self.init(contentsOf: type(of:self).urlOfModelInThisBundle, configuration: configuration)
    }

"WatchKit App Extension[441:999198] [espresso] [Espresso::handle_ex_] exception=Unsupported engine type"
TimCo
  • 41
  • 8

0 Answers0