Converting Huggingface Model to work on iOS
4/13/2025
Converting Hugging Face model to work with iOS
I wanted to be able to utilize a hugging face model running locally on an iOS device. I have read that it's possible to do this, but after a few hours of of attempting to do this, it turns out that it's actually quite difficult.
I wanted to use this model here:
Falconsai/text_summarization
Google Gemini 2.5 pro said this about my attempt:
Sequence-to-sequence models like Pegasus can be more complex to convert than other types because they have distinct encoder and decoder components. Hugging Face's optimum library is often the best tool for this, as it's designed to handle these conversions.
Here's a Python script you can run in a Google Colab notebook. It includes installing dependencies, loading the model, attempting the conversion using optimum, and preparing the resulting Core ML package for download.
Encountered endless dependency errors and I've been trying to keep everything inside Google because it seemed like Google has the best tools for Python, especially with its Google Colab environment.
Perhaps it's the model that I'm trying to use that's the problem or perhaps it's just using Python dependencies inside Google Google Colab.