Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using CoreML on macOS #137

Open
JonasPfeifer05 opened this issue Dec 15, 2024 · 5 comments
Open

Using CoreML on macOS #137

JonasPfeifer05 opened this issue Dec 15, 2024 · 5 comments

Comments

@JonasPfeifer05
Copy link

Hello, I have a MacBook with a M4 chip which comes with a neural engine. But when using fastembed, the neural engine is not used at all, instead the cpu is running on 100%.

Is there a way to tell fastembed to use the neural engine?

Or is this feature just missing?

@JonasPfeifer05
Copy link
Author

Monitoring during running:

image

@Anush008
Copy link
Owner

Anush008 commented Dec 16, 2024

Hey 👋. Can you try using

/// Set the execution providers for the model
pub fn with_execution_providers(
mut self,
execution_providers: Vec<ExecutionProviderDispatch>,
) -> Self {
self.execution_providers = execution_providers;
self
}
?

Ref: https://ort.pyke.io/perf/execution-providers for CoreML

@aim-bot-mtl
Copy link

aim-bot-mtl commented Dec 16, 2024

Hey @Anush008 !!

Do you think that adding "default execution providers" can be a good idea ?

Something like this:

.with_execution_providers({
	#[cfg(any(target_os = "macos", target_os = "ios"))]
	{
		use ort::{CoreMLExecutionProvider, XNNPACKExecutionProvider};

		[
			CoreMLExecutionProvider::default().build(),
			XNNPACKExecutionProvider::default().build(),
		]
	}

	#[cfg(target_os = "windows")]
	{
		use ort::DirectMLExecutionProvider;

		[DirectMLExecutionProvider::default().build()]
	}

	...
})

If yes, I'll try smtg this week and PR it ;) Cool lib and cool resource to learn basic things with ort btw ! :)

Not my main gh account, thats why it looks weird lol (@PierreLouisLetoquart)

@Anush008
Copy link
Owner

I believe this would be better left to the users to choose.

@aim-bot-mtl
Copy link

Okay yes thats what I thought because of the large model choice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants