Carton is an open-source API designed to facilitate the execution of machine learning (ML) models across various programming languages without the need for complex conversions or framework-specific code. By encapsulating models with essential metadata into a standardized zip file, Carton ensures seamless integration and deployment, allowing developers to focus on application logic rather than compatibility issues.
Key Features and Functionality:
- Framework-Agnostic Execution: Carton enables the running of ML models from any programming language, including Python, JavaScript, TypeScript, Rust, C, C++, C#, Java, Golang, Swift, Ruby, PHP, Kotlin, and Scala.
- Model Packaging: It wraps models with metadata into a zip file without altering the original model, thereby avoiding error-prone conversion steps.
- Automatic Runner Selection: Upon loading a packed model, Carton reads the included metadata to determine the appropriate "runner" and fetches it automatically if needed.
- Optimized Performance: Implemented in Rust with bindings to multiple languages, Carton offers an optimized core that minimizes overhead, with preliminary benchmarks indicating less than 100 microseconds per inference call.
- Cross-Platform Support: Supports x86_64 Linux and macOS, aarch64 Linux (e.g., AWS Graviton), aarch64 macOS (e.g., Apple Silicon chips), and WebAssembly (with upcoming support for WebGPU runners).
Primary Value and Problem Solved:
Carton addresses the challenge of running ML models across different programming environments by providing a unified, framework-agnostic API. This eliminates the need for developers to write framework-specific code or perform complex model conversions, thereby accelerating development cycles and reducing potential errors. By decoupling inference code from specific ML frameworks, Carton enables developers to stay current with advancements in the field without being tied to a particular technology stack.