File size: 1,519 Bytes
196c27d
e7aef18
 
 
 
196c27d
b103811
196c27d
 
 
 
e7aef18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
title: SLM 264M Data Transformer
emoji: πŸ”„
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 5.9.1
app_file: app.py
pinned: false
---

# SLM-264M Data Transformer β€” demo Space

A Gradio front-end for the `slm-264m` data-transformer fine-tune: convert data between
**CSV, JSON, and XML** with a 264M-parameter model trained from scratch, running on CPU.

## How it's wired

- **Code lives here** (`app.py`, `model.py`).
- **Weights live in the model repo** and are downloaded at startup with
  `huggingface_hub.hf_hub_download`. Set the repo in `app.py`:
  ```python
  MODEL_REPO = "uday210/slm-264m-transform"   # your fine-tune
  CKPT_FILENAME = "slm-264m-transform.pt"
  TOKENIZER_FILENAME = "tokenizer.json"
  ```
- If the model repo is **private**, add an `HF_TOKEN` secret under
  *Settings β†’ Variables and secrets*.

## Files you must add

1. **`model.py`** β€” copy it from your training repo. This Space cannot load the checkpoint
   without your exact `GPT`/`GPTConfig` classes (custom GQA + RoPE architecture).
   It must be import-safe (no training at file top level).
2. Make sure the model repo actually contains the checkpoint and `tokenizer.json`.

## Notes / limits

- CPU inference: a few tok/s. Fine for a demo. For speed, upgrade the Space hardware or
  wire in the KV-cache generation path from your deployment notes.
- The prompt template in `app.py` must match how the fine-tune was trained.
- Numeric transcription is the model's known weak spot; structure and text are reliable.