CoolFace
Modelpublic

anziank/grio-qwen2.5-0.5b-coreml-anyLM-seq2048

sourceHugging Faceapache-2.0updated 4mo agoView on Hugging Face
0likes17downloads
Model Card

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

PropertyValue
Base modelQwen/Qwen2.5-0.5B-Instruct
PrecisionFloat16 (mlprogram)
Context window1–2048 tokens (flexible, RangeDim)
Input: inputIdsInt32 [1, ≤2048]
Input: attentionMaskInt32 [1, ≤2048]
Output: logitsFloat16 [1, seq_len, vocab_size]
Min deploymentiOS 18 / macOS 15
Compute.all (ANE + GPU + CPU)
Format.mlpackage (mlprogram, compiled on first load)

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)

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.