CoreMLPipelines is an experimental library for running pretrained Core ML models to perform different tasks. Currently, the following pipelines are supported:
- Text Generation: Generate text using a pretrained language model.
import CoreMLPipelines
let pipeline = try await TextGenerationPipeline(model: .llama_3_2_1B_Instruct_4bit)
let stream = pipeline(
messages: [[
"role": "user",
"content": "Write a poem about Ireland"
]]
)
for try await text in stream {
print(text, terminator: "")
}USAGE: coremltoolkit-cli generate-text [--model <model>] [<prompt>] [--max-new-tokens <max-new-tokens>]
ARGUMENTS:
<prompt> (default: Hello)
OPTIONS:
--model <model> Hugging Face repo ID (e.g. 'finnvoorhees/coreml-Llama-3.2-1B-Instruct-4bit')
--max-new-tokens <max-new-tokens>
USAGE: coremltoolkit-cli chat [--model <model>]
OPTIONS:
--model <model> Hugging Face repo ID (e.g. 'finnvoorhees/coreml-Llama-3.2-1B-Instruct-4bit')
