How can I get the .mlmodel version programmatically?

I have .mlmodel file and I need to get the version of this file (from the metadata) programmatically. I know that we can do it using for .mlmodelc file usingMLModel instance, but what about .mlmodel?

Thanks!

Accepted Answer

I think you can use SwiftCoreMLTools package.

If it doesn't work, Core ML format is open-source and based on Protocol Buffer. And Protocol Buffer support for Swift has been open-sourced by Apple as a package.

Information you need is here.


/** 
 * A Core ML model, 
 * consisting of a specification version, 
 * a model description, and a model type.
 * ...
 **/
message Model {
    int32 specificationVersion = 1;
    // ...
}
How can I get the .mlmodel version programmatically?
 
 
Q