transformers-to-mlx

Convert Hugging Face transformers models to MLX format for Apple Silicon inference.

51|6|Updated Apr 15, 2026
One-click install
npx skills add https://github.com/huggingface/transformers-to-mlx --skill transformers-to-mlx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: transformers-to-mlx
Source: https://github.com/huggingface/transformers-to-mlx/tree/main/skills/transformers-to-mlx
Command: npx skills add https://github.com/huggingface/transformers-to-mlx --skill transformers-to-mlx

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, transformers, mlx, mlx-lm, safetensors, numpy, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Manually porting Hugging Face transformers language models to MLX for Apple Silicon inference requires handling diverse architectures, weight name remapping, dtype validation, and rigorous testing against original model outputs — a time-consuming and error-prone process for developers. This skill automates the entire end-to-end conversion workflow.

Core Features & Use Cases

  • End-to-end model conversion: Automates the full process of porting LLMs from transformers to the mlx-lm ecosystem, supporting standard attention, MoE, MLA, hybrid SSM+attention, GatedDeltaNet, and other modern architectures.
  • Built-in validation suite: Includes tools for generation quality comparison, numerical logits verification, layer-by-layer divergence detection, and runtime dtype checking to ensure converted models match original transformer behavior.
  • Streamlined PR workflow: Automates creation of pull requests for both the mlx-lm codebase and the associated test harness, with guidance for large model handling, quantization, and distributed inference setup.
  • Use case: A developer looking to run a new LLM like OLMo-Hybrid on Apple Silicon can use this skill to handle the full conversion, testing, and contribution workflow without manually reimplementing the model architecture or writing custom validation scripts.

Quick Start

Ask your AI assistant to convert the olmo_hybrid transformer model to MLX for Apple Silicon, run all required validation tests, and prepare a pull request for the mlx-lm codebase.

Frequently Asked Questions about transformers-to-mlx

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert Hugging Face transformers models to MLX for Apple Silicon?

Converting Hugging Face transformers models to MLX for Apple Silicon involves automating weight name remapping, dtype validation, and config analysis. This process ensures the model architecture is correctly ported for local inference without manual code rewriting.

What is the best way to port an LLM with hybrid SSM+attention to MLX?

Porting an LLM with hybrid SSM+attention to MLX requires handling modern architectures beyond standard attention. The conversion workflow supports architectures like MoE, MLA, and GatedDeltaNet, ensuring complex transformer models run natively on Apple Silicon.

Does MLX model conversion support automated numerical logits verification?

Yes, MLX model conversion supports automated numerical logits verification. The workflow includes a validation suite with generation quality comparison, layer-by-layer divergence detection, and runtime dtype checking to ensure converted models match original transformer behavior.

Can I automate pull request creation for the mlx-lm codebase after porting a model?

Yes, you can automate pull request creation for the mlx-lm codebase after porting a model. The conversion workflow streamlines PR creation for both the mlx-lm repository and its associated test harness to simplify contributions.

Do I need to manually validate weight sanitization when moving transformers to MLX?

No, you do not need to manually validate weight sanitization when moving transformers to MLX. The automated conversion process includes built-in tools for weight sanitization, dtype validation, and numerical checks to ensure accurate model behavior.

How do I handle quantization and distributed inference setup for MLX LLMs?

Handling quantization and distributed inference setup for MLX LLMs is integrated into the conversion workflow. The process provides specific guidance for large model handling and configuring distributed inference environments on Apple Silicon.