Error loading a model of CoreML

Hello, I'm new using CoreML and I'm trying to do a test app with the models that already exist.

I'm having next error at the moment to classifier the image:

[coreml] Failed to get the home directory when checking model path.

I would like to receive your help to solve this error. Thanks.

I have also been struggling with this exact issue and feel that it should be a simple solution I am missing. Do you have any updates?

I am having the same issue in my own project and was hoping you had any positive updates?

I have the same issue and don't know how to resolve it as well. I created a simple Tabular Regressor, dragged and dropped the .mlmodel file into Xcode as shown by HackingWithSwift (https://www.youtube.com/watch?v=554iAZE0Qq8). I tried all options for adding these files and I always get the same warning. Though, I can still use the trained model, it works but it just spams the debug area.

I am having exactly the same issue. Could this be an Xcode bug?

I am having exactly the same issue. mac OS 13.1 ; xcode 14.2

I'm having the same issue on mac OX 13.2 / Xcode 14.2.

Has anyone found the solution ?

Has anyone resolved this issue yet? I am getting the same error when working through 100 days of SwiftUI.

Thanks

I'm having the same issue on mac OX 13.2.1/ Xcode 14.2.

Same issue here!

"[coreml] Failed to get the home directory when checking model path." error from Xcode 14.2 when running app in simulator. Was hoping to find solution here

After removing and re-adding the coreml model file to the project, it began functioning properly.

I had the same problem working on the tutorial Hacking with Swift from Paul.

Here I found the explanation: https://codecrew.codewithchris.com/t/core-ml-module-own-model-does-not-work/22028/4

from Inaki: However, what worked for me is to run the app on an actual device (an iPhone in my case). I’m not sure if this is due to a breaking change with Xcode 14, but running the model requires access to the home directory now compared to when it was recorded (for some reasons unknown to me), and you can’t access that directory in SwiftUI preview and iOS simulator due to it being sandboxed.

You can, however, have the app access to this directory by using an actual device to test your app.

So, running the app on a real device I don't see a problem anymore.

You can fix this error with the following code, however, predictions simply do not work correctly in the Simulator, you must use an actual device:

        #if targetEnvironment(simulator)
            imageClassificationRequest.usesCPUOnly = true;
        #endif
Error loading a model of CoreML
 
 
Q