--- license: mit tags: - onnx - smartwatch - intent-classification - text-generation - wearable library_name: onnxruntime pipeline_tag: text-generation --- # Smartwatch LM v0.1 Small GPT-style language model trained for wrist-wearable assistant chat. The model learns conversational replies and emits intent tags such as `` that your app can parse and route to device handlers. ## Model details | Property | Value | |----------|-------| | Architecture | 6-layer causal GPT (~28M params) | | Context length | 256 tokens | | Vocab size | 3524 (BPE) | | Training data | Synthetic smartwatch conversations (`tinydata.txt`) | | Export version | 0.1 | ## Files in this repo | File | Purpose | |------|---------| | `smartwatch_lm_merged.onnx` | Browser/on-device inference (ONNX Runtime, opset 17) | | `checkpoint.pt` | PyTorch weights for fine-tuning or local chat | | `tokenizer.json` | BPE tokenizer (Hugging Face Tokenizers format) | | `tokenizer_config.json` | Tokenizer metadata | | `config.json` | Model architecture and ONNX I/O names | | `model.py` | PyTorch model definition + checkpoint loader | | `chat.py` | Interactive chat helper | | `config.py` | Generation defaults | ## ONNX inference **Inputs:** `input_ids` — int64 tensor, shape `[batch, seq]` (max seq = 256) **Outputs:** `logits` — float tensor, shape `[batch, seq, vocab_size]` Works with ONNX Runtime (CPU, WASM, WebGPU). The merged ONNX file is a single ~52 MB artifact suitable for browser deployment. ```python import numpy as np import onnxruntime as ort session = ort.InferenceSession("smartwatch_lm_merged.onnx", providers=["CPUExecutionProvider"]) x = np.zeros((1, 8), dtype=np.int64) logits = session.run(None, {"input_ids": x})[0] print(logits.shape) # (1, 8, 3524) ``` ## PyTorch chat ```bash pip install torch tokenizers python chat.py ``` Or in Python: ```python from pathlib import Path from chat import ChatSession bot = ChatSession( checkpoint_path=Path("checkpoint.pt"), tokenizer_path=Path("tokenizer.json"), ) print(bot.say("How many steps have I taken today?")) print(bot.say("thanks")) ``` ## Prompt format ``` user: How many steps have I taken today? bot: You're at of — keep going! ``` The model predicts the next token. Slot placeholders like `` are filled by your runtime with live sensor data. ## Intended use On-device smartwatch / wearable assistant demos. Not intended for general-purpose chat or safety-critical applications. ## Documentation | Guide | Description | |-------|-------------| | [Intent reference](docs/intent-reference.md) | All 35 intents and slot placeholders | | [Web output quality](docs/web-output-quality.md) | Sampling, cleanup, and anti-gibberish techniques for browser/on-device runtimes | | [Smartwatch integration](docs/smartwatch-integration.md) | End-to-end guide to wire the model into wrist hardware | Live browser demo: see the `collab-run-1/web` app in the electron-v1 training project (links to this model on Hugging Face). ## Limitations - Trained on synthetic data; behavior on real user phrasing may vary - Does not output real metric values — only intents and slot tokens - Small model with limited reasoning capability