Skip to content

Releases: schappim/coreml-cli

Release list

v1.1.0

Choose a tag to compare

@schappim schappim released this 04 Sep 22:29

Core ML CLI v1.1.0

coreml serve — run a model as a local HTTP API

The model is compiled and loaded once at startup and stays warm, so requests skip the model-loading cost that a fresh coreml predict pays every time. That makes a Core ML model callable from any language, not just the shell.

coreml serve MobileNetV2.mlmodel
curl -X POST -H 'Content-Type: image/jpeg' --data-binary @photo.jpg \
  'http://127.0.0.1:8080/v1/predict?top=3'
  • GET /health · GET /v1/info · POST /v1/predict
  • Input as raw bytes, a multipart/form-data upload (curl -F file=@photo.jpg), or JSON
  • Multi-input models are reachable for the first time. coreml predict feeds one file to the model, so a model with several inputs could not be driven from the CLI at all. Now:
    curl -X POST -H 'Content-Type: application/json' \
      -d '{"inputs": {"sepal_length": 5.1, "sepal_width": 3.5, "petal_length": 1.4, "petal_width": 0.2}}' \
      http://127.0.0.1:8080/v1/predict
  • ?top=N trims classifier dictionaries and adds an ordered ranked array, since JSON objects carry no ordering
  • Binds loopback by default. --api-key, --cors, --allowed-host, --concurrency, --max-body-mb for anything wider
  • The startup banner prints a curl line matching your model's own input type, so the first request is a copy-paste

Fixed

  • Image prediction was ~6x slower than it needed to be. A CIContext was built for every prediction; creating one sets up a GPU pipeline and cost far more than the render it was made for. 40 images through coreml batch went from 2905 ms to 465 ms. Affects predict and batch, not just serve.
  • coreml meta set --output could delete the model it was editing. The destination was removed before the source was copied into it, with nothing checking the two were different, so an --output naming the source erased it. Now refused, and the clone is staged and swapped in only after the write succeeds.
  • Multi-array outputs were truncated at 100 elements, so JSON results from embedding models silently lost data.
  • A JSON tensor that did not match the model's input shape was silently truncated or left partly uninitialised, producing garbage predictions. Now an error naming both counts. Non-numeric values in a tensor are rejected rather than dropped.

Changed

  • swift-argument-parser 1.7.1 → 1.8.2
  • CI and Dependabot configured for the repository
  • Test suite grown from 105 to 212 tests

Requirements

  • macOS 13.0 or later
  • Apple Silicon or Intel Mac (the binary is universal)

Installation

Homebrew

brew tap schappim/coreml-cli
brew install coreml-cli

Manual

tar -xzf coreml-1.1.0-macos.tar.gz
sudo cp coreml /usr/local/bin/

v1.0.0

Choose a tag to compare

@schappim schappim released this 21 Jan 03:14

Core ML CLI v1.0.0

A native command-line interface for working with Apple Core ML models on macOS.

Features

  • inspect - View model structure, inputs/outputs, and metadata
  • predict - Run inference on images, text, or JSON data
  • batch - Process multiple files with concurrent execution
  • benchmark - Measure inference latency and throughput
  • compile - Convert .mlmodel to optimized .mlmodelc format
  • meta - View and manage model metadata

Requirements

  • macOS 13.0 or later
  • Apple Silicon or Intel Mac

Installation

Homebrew (recommended)

brew tap schappim/coreml-cli
brew install coreml-cli

Manual

Download coreml-1.0.0-macos.tar.gz, extract, and copy to your PATH:

tar -xzf coreml-1.0.0-macos.tar.gz
sudo cp coreml /usr/local/bin/

Quick Start

coreml inspect MobileNetV2.mlmodel
coreml predict MobileNetV2.mlmodel --input photo.jpg
coreml benchmark MobileNetV2.mlmodel --input sample.jpg