--- tags: - coreml - apple - watchos - tinybrain library_name: coreml --- # TinyGPT2 for TinyBrain This repository packages `sshleifer/tiny-gpt2` for the TinyBrain runtime on Apple Watch. ## TinyBrain bundle contract The conversion script produces a single bundle archive: - `tinygpt2_only_logits.mlmodelc.zip` The zip layout is: - `tinygpt2_only_logits.mlmodelc/` - `tokenizer/` - `metadata.json` ## Runtime interface - Task: causal language modeling - Inputs: - `input_ids` (`Int32`, shape `1 x 16`) - `attention_mask` (`Int32`, shape `1 x 16`) - Output: - `logits` ## Files included in `tokenizer/` - `tokenizer.json` when provided by Transformers - `vocab.json` - `merges.txt` - `special_tokens_map.json` - `tokenizer_config.json` - `token_decoder.json` ## Build Run: ```bash python3 convert_tinygpt2_to_coreml.py ``` The script: 1. Downloads the model and tokenizer from Hugging Face. 2. Converts the model to Core ML. 3. Compiles the package to `.mlmodelc`. 4. Writes TinyBrain runtime metadata. 5. Packages the compiled model, tokenizer, and metadata into one zip.