Skip to main content
  1. Posts/

Model Fine Tuning With Elixir

Recently I have been experimenting with elixir machine learning. I decided to recreate fast.ai “bird or not” fine tuning tutorial. The language and the livebooks made it a very pleasant experience.

This post is a collection of notes about it.

  • Initially I wanted to use EMLX to use MLX as a backend for NX. But I only managed to make it work for classification without fine tuning, so this is something I will try in the future.
  • In chunk_every call I’m using discard to avoid doing additional padding of the training/testing data, as my datasets didn’t divide evenly.
  • As model spec already had labels all I needed to do is override them with my own.
  • The dataset already has all images sized to 224x224 so there is on need to resize them. In case your images are different you’ll need to Nx.reshape them or resize them.
  • I spent a lot of time debugging only to find out the problem was the shape of image dataset stream that I was loading. It needs to be a batched stream.

Livebook on github and dataset on huggingface