coreml-rootmodelidentifier-crash-poc / CoreMLCompileOne.swift
cmpndry's picture
Add Core ML rootModelIdentifier crash PoC (seed + manifests + rebuild script)
87234eb verified
Raw
History Blame Contribute Delete
618 Bytes
import CoreML
import Foundation
guard CommandLine.arguments.count == 2 else {
print("usage: CoreMLCompileOne <path-to-mlpackage-or-mlmodel>")
exit(2)
}
let package = URL(fileURLWithPath: CommandLine.arguments[1])
do {
let compiled = try MLModel.compileModel(at: package)
print("COMPILE_OK")
print("COMPILED_PATH=\(compiled.path)")
let model = try MLModel(contentsOf: compiled)
print("LOAD_OK")
print("INPUTS=\(Array(model.modelDescription.inputDescriptionsByName.keys).sorted().joined(separator: ","))")
} catch {
print("CONTROLLED_ERROR")
print(String(describing: error))
}