|
Download README.md from prathamkode/smartwatch-lm-0.1: direct link, hf CLI and curl.
- Browser
- Download file 3.26 kB
-
https://huggingface.co/prathamkode/smartwatch-lm-0.1/resolve/main/README.md
- Command line
-
hf download hf://prathamkode/smartwatch-lm-0.1/README.md
-
curl -L -o README.md https://huggingface.co/prathamkode/smartwatch-lm-0.1/resolve/main/README.md
3.26 kB
| 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 `<INTENT:GET_STEPS>` that your app can parse and route to device handlers. | |
| ## Model details | |
| | Property | Value | | |
| |----------|-------| | |
| | Architecture | 6-layer causal GPT (**~12M params**) | | |
| | Context length | 256 tokens | | |
| | Vocab size | 3524 (BPE) | | |
| | Export version | 0.1 | | |
| ## Files in this repo | |
| | File | Purpose | | |
| |------|---------| | |
| | `smartwatch_lm_merged.onnx` | 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 PyTorch chat | | |
| | `reply_utils.py` | Gibberish cleanup, intent parse, slot fill | | |
| | `onnx_sample.py` | ONNX generate + cleanup sample script | | |
| | `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. | |
| ```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) | |
| ``` | |
| Quick chat with cleanup: | |
| ```bash | |
| pip install numpy onnxruntime tokenizers | |
| python onnx_sample.py "How many steps today?" | |
| ``` | |
| ## PyTorch chat | |
| ```bash | |
| pip install torch tokenizers | |
| python chat.py | |
| ``` | |
| ```python | |
| from chat import ChatSession | |
| bot = ChatSession(temperature=0.5, max_new_tokens=40, top_k=40) | |
| print(bot.say("How many steps have I taken today?")) | |
| ``` | |
| ## Prompt format | |
| ``` | |
| user: How many steps have I taken today? | |
| bot: <INTENT:GET_STEPS> You're at <STEPS_TODAY> of <STEP_GOAL> — keep going! | |
| ``` | |
| The model predicts the next token. Slot placeholders like `<STEPS_TODAY>` are filled by your runtime with live sensor data. | |
| ## Documentation | |
| | Guide | Description | | |
| |-------|-------------| | |
| | [Avoiding gibberish](docs/avoiding-gibberish.md) | Special characters to strip, truncation rules, sample scripts | | |
| | [Intent reference](docs/intent-reference.md) | All 35 intents and slot placeholders | | |
| | [Smartwatch integration](docs/smartwatch-integration.md) | End-to-end device wiring | | |
| ## Intended use | |
| On-device smartwatch / wearable assistant demos. Not intended for general-purpose chat or safety-critical applications. | |
| ## Limitations | |
| - Trained on synthetic data; behavior on real user phrasing may vary | |
| - Does not output real metric values — only intents and slot tokens | |
| - Small 12M model with limited reasoning capability | |