Skip to content

Commit 4224f16

Browse files
committed
up
1 parent 5ff0208 commit 4224f16

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

backends/apple/coreml/runtime/delegate/ETCoreMLModelManager.mm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ - (nullable NSURL *)compiledModelURLWithIdentifier:(NSString *)identifier
431431
return nil;
432432
}
433433

434-
NSURL *dstURL = [self.assetManager.trashDirectoryURL URLByAppendingPathComponent:[NSUUID UUID].UUIDString];
434+
NSURL *dstURL = [self.assetManager.assetsDirectoryPath URLByAppendingPathComponent:[NSUUID UUID].UUIDString];
435435
NSURL *modelURL = ::write_model_files(dstURL, self.fileManager, identifier, modelAssetType.value(), inMemoryFS, error);
436436
switch (modelAssetType.value()) {
437437
case ModelAssetType::CompiledModel: {
@@ -444,6 +444,10 @@ - (nullable NSURL *)compiledModelURLWithIdentifier:(NSString *)identifier
444444
NSURL *compiledModelURL = [ETCoreMLModelCompiler compileModelAtURL:modelURL
445445
maxWaitTimeInSeconds:(5 * 60)
446446
error:error];
447+
// Clean up modelURL
448+
if (modelURL && modelURL.isFileURL) {
449+
[self.fileManager removeItemAtURL:modelURL error:nil];
450+
}
447451

448452
return compiledModelURL;
449453
}

0 commit comments

Comments
 (0)