anziank/grio-qwen2.5-0.5b-coreml-anyLM-seq2048
Qwen 2.5 0.5B Instruct — CoreML (seq≤2048, AnyLanguageModel-compatible)
On-device CoreML .mlpackage converted from `Qwen/Qwen2.5-0.5B-Instruct` using coremltools, for use with Apple's AnyLanguageModel Swift framework and swift-transformers ≥ 1.0.
Input tensor names match the inputIds / attentionMask convention required by swift-transformers 1.x LanguageModel. Drop-in compatible with CoreMLLanguageModel(url:computeUnits:chatTemplateHandler:).
Model details
Intended use
Designed for on-device AI text enhancement and translation in the Grio app. Suitable for any iOS 18+ / macOS 15+ Swift application using AnyLanguageModel.
Limitations
- Flexible up to 2048 tokens via RangeDim — runtime pads as needed.
- Requires iOS 18 / macOS 15 or later (mlprogram format).
- Not benchmarked for production accuracy; intended for short-form text correction and enhancement tasks.
Usage (Swift)
import AnyLanguageModel
let modelURL: URL = // path to this .mlpackage on disk
let lm = try await CoreMLLanguageModel(
url: modelURL,
computeUnits: .all,
chatTemplateHandler: { instructions, prompt in
// Qwen 2.5 uses ChatML format; tokenizer.json Jinja template applies special tokens
var messages: [Message] = []
if let system = instructions?.description, !system.isEmpty {
messages.append(["role": "system", "content": system])
}
messages.append(["role": "user", "content": prompt.description])
return messages
}
)
let session = LanguageModelSession(model: lm, instructions: "You are a helpful assistant.")
let response = try await session.respond(to: "Improve this text: ...")
print(response.content)Tokenizer files (tokenizer.json, tokenizer_config.json, config.json) are bundled alongside the .mlpackage in this repo. Keep them as siblings on disk — swift-transformers resolves the chat template from tokenizer_config.json at runtime.
License
Apache-2.0. Weights from `Qwen/Qwen2.5-0.5B-Instruct` by Qwen Team / Alibaba Cloud.
