Skip to content

Profile your CoreML models directly from Python ๐Ÿ

Notifications You must be signed in to change notification settings

fadeaway-ai/coremlprofiler

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

19 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

CoreML (Python) Profiler ๐Ÿ

Quick and easy profiling of CoreML models in Python!

Quick Start โšก๏ธ

#convert model using guide: https://apple.github.io/coremltools/docs-guides/source/introductory-quickstart.html
#or download one from the ๐Ÿค— Hub 
from coremlprofiler import CoreMLProfiler, ComputeUnitSetting
from huggingface_hub import snapshot_download

repo_path = snapshot_download(repo_id="FL33TW00D-HF/test-st", local_dir="./")
model_path = repo_path + "/sentence_transformer_all-MiniLM-L6-v2.mlpackage"

# Create the Profiler (optionally specify compute units)
profiler = CoreMLProfiler(
    model_path,
    compute_units=ComputeUnitSetting.CPU_AND_NE  # Optional, defaults to ALL
)

# Print your device usage
print(profiler.device_usage_summary_chart())
# Enjoy your nice plot!

Python Profiling

CLI

Profile a local model:

coremlprofile path/to/my/model.mlpackage

Download from Hugging Face and profile:

coremlprofile --hf_repo="FL33TW00D-HF/test-st" sentence_transformer_all-MiniLM-L6-v2.mlpackage

Specify compute units to use:

coremlprofile path/to/my/model.mlpackage --compute_units cpuAndNeuralEngine

Available compute unit options:

  • all (default): Use all available compute units
  • cpuAndGPU: Use CPU and GPU only
  • cpuAndNeuralEngine: Use CPU and Neural Engine only
  • cpuOnly: Use CPU only

About

Profile your CoreML models directly from Python ๐Ÿ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%