Apple releases open-source Python framework for machine learning

Apple publishes MLX – an array framework for machine learning on Apple silicon, brought to you by Apple machine learning research.

Some key features of MLX include:

  • Familiar APIs: MLX has a Python API that closely follows NumPy. MLX also has a fully featured C++ API, which closely mirrors the Python API. MLX has higher-level packages like mlx.nn and mlx.optimizers with APIs that closely follow PyTorch to simplify building more complex models.
  • Composable function transformations: MLX has composable function transformations for automatic differentiation, automatic vectorization, and computation graph optimization.
  • Lazy computation: Computations in MLX are lazy. Arrays are only materialized when needed.
  • Dynamic graph construction: Computation graphs in MLX are built dynamically. Changing the shapes of function arguments does not trigger slow compilations, and debugging is simple and intuitive.
  • Multi-device: Operations can run on any of the supported devices (currently, the CPU and GPU).
  • Unified memory: A notable difference from MLX and other frameworks is the unified memory model. Arrays in MLX live in shared memory. Operations on MLX arrays can be performed on any of the supported device types without moving data.
MLX

Framework is available under MIT license and comes with examples on various machine learning tasks.

GitHub: mlx

Weekend good reads for Apple developers #2023/34

Small list for this weekend, so – more time to unwind. Let's go.

That is it for today. Have a great weekend and come back next Friday for another pack of great reads!

Hugging Face releases tools allowing running LLMs on devices

Hugging Face releases Swift Transformers – package to implement transformers APIs in Swift.

Overall, couple of products were released and updated:

  • swift-transformers, an in-development Swift package to implement a transformers-like API in Swift focused on text generation. It is an evolution of swift-coreml-transformers with broader goals: Hub integration, arbitrary tokenizer support, and pluggable models.
  • swift-chat, a simple app demonstrating how to use the package.
  • An updated version of exporters, a Core ML conversion package for transformers models.
  • An updated version of transformers-to-coreml, a no-code Core ML conversion tool built on exporters.
  • Some converted models, such as Llama 2 7B or Falcon 7B, ready for use with these text generation tools.

Package currently supports following models:

  • Llama 2;
  • Falcon;
  • StarCoder models, based on a variant of the GPT architecture;
  • GPT family, including GPT2, distilgpt, GPT-NeoX, GPT-J.

As of now package is in active development. It is not expected to be used in production projects without appropriate testing.

GitHub:

Hugging Face: Releasing Swift Transformers: Run On-Device LLMs in Apple Devices