We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 33d5df7 commit ae290f1Copy full SHA for ae290f1
swift/Encoders.swift
@@ -99,7 +99,8 @@ func readConfig(fromPath path: String) throws -> [String: Any] {
99
/// - computeUnits: The hardware devices to use for model computation.
100
/// - Returns: An instance of `MLModel`.
101
func readModel(fromURL modelURL: URL, computeUnits: MLComputeUnits = .all) throws -> MLModel {
102
- let compiledModelURL = try MLModel.compileModel(at: modelURL)
+ let compiledModelURL =
103
+ modelURL.absoluteString.hasSuffix(".mlmodelc/") ? modelURL : try MLModel.compileModel(at: modelURL)
104
let config = MLModelConfiguration()
105
config.computeUnits = computeUnits
106
return try MLModel(contentsOf: compiledModelURL, configuration: config)
0 commit comments