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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple Silicone Neural Engine: Core ML model package format support #7105

Open
1 task done
qdrddr opened this issue Apr 25, 2024 · 5 comments
Open
1 task done

Apple Silicone Neural Engine: Core ML model package format support #7105

qdrddr opened this issue Apr 25, 2024 · 5 comments

Comments

@qdrddr
Copy link

qdrddr commented Apr 25, 2024

Duplicates

  • I have searched the existing issues

Summary 馃挕

Problem

Please consider adding Core ML model package format support to utilize Apple Silicone Nural Engine + GPU.

Examples 馃寛

Additional context
List of Core ML package format models

https://github.com/likedan/Awesome-CoreML-Models

Motivation 馃敠

Utilize both ANE & GPU, not just GPU on Apple Silicon

@ntindle
Copy link
Member

ntindle commented Apr 25, 2024

Do you have a quick start on this? Haven鈥檛 looked into core ML at all

@qdrddr
Copy link
Author

qdrddr commented Apr 25, 2024

Hi, yes. @ntindle

This is about running LLMs locally on Apple Silicone. Core ML is a framework that can redistribute workload across CPU, GPU & Nural Engine (ANE). ANE is available on all modern Apple Devices: iPhones & Macs (A14 or newer and M1 or newer). Ideally, we want to run LLMs on ANE only as it has optimizations for running ML tasks compared to GPU. Apple claims "deploying your Transformer models on Apple devices with an A14 or newer and M1 or newer chip to achieve up to 10 times faster and 14 times lower peak memory consumption compared to baseline implementations".

  1. To utilize Core ML first, you need to convert a model from TensorFlow, PyTorch to Core ML model package format using coremltools (or simply utilize existing models in Core ML package format ).
  2. Second, you must now use that converted package with an implementation designed for Apple Devices. Here is the Apple XCode reference PyTorch implementation.

https://machinelearning.apple.com/research/neural-engine-transformers

@ntindle
Copy link
Member

ntindle commented Apr 25, 2024

We don't package any models with our code. Is it possible to use tools like Llamafile to do this?

@qdrddr
Copy link
Author

qdrddr commented Apr 25, 2024

I mean, it was a general overview; you don't have to package models; you just need to be able to use CoreML packaged models.

Work in progress on CoreML implementation for [whisper.cpp]. They see x3 performance improvements for some models. (ggerganov/whisper.cpp#548) you might be interested in.

You might also be interested in another implementation Swift Transformers. Example of CoreML application
https://github.com/huggingface/swift-chat

@qdrddr qdrddr changed the title Apple Silicone Nural Engine: Core ML model package format support Apple Silicone Neural Engine: Core ML model package format support Apr 26, 2024
@kcze
Copy link
Contributor

kcze commented Apr 30, 2024

I'll be interested to look into this at some point

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