AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Apple Silicone Neural Engine: Core ML model package format support

Open qdrddr opened this issue 10 months ago • 7 comments

Duplicates

  • [X] 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

qdrddr avatar Apr 25 '24 01:04 qdrddr

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

ntindle avatar Apr 25 '24 01:04 ntindle

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

qdrddr avatar Apr 25 '24 12:04 qdrddr

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

ntindle avatar Apr 25 '24 13:04 ntindle

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. (https://github.com/ggerganov/whisper.cpp/discussions/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 avatar Apr 25 '24 13:04 qdrddr

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

kcze avatar Apr 30 '24 09:04 kcze

https://appleinsider.com/articles/24/05/07/secret-apple-project-acdc-to-pioneer-ai-chips-for-data-centers

Under the internal name "Project ACDC," Apple is developing Apple Silicon designed specifically for server farms dedicated to AI processing. The company aims to optimize AI applications within its data centers for future versions of its platforms.

qdrddr avatar May 22 '24 01:05 qdrddr

Are you guys using llama.cpp in AutoGPT?

qdrddr avatar Jun 14 '24 15:06 qdrddr