Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Apochat-tuned Gemma 4 E2B → LiteRT export
|
| 2 |
+
|
| 3 |
+
This folder contains a script that converts the public Apochat-tuned MLX model into a
|
| 4 |
+
`.litertlm` package that the iOS/macOS app can run with the LiteRT backend.
|
| 5 |
+
|
| 6 |
+
**Do not run this on the 16 GB local Mac** — the conversion peaks at more than 16 GB of
|
| 7 |
+
memory. Run it on a machine with at least:
|
| 8 |
+
|
| 9 |
+
- 32 GB of CPU RAM, or
|
| 10 |
+
- A GPU with 24 GB+ VRAM.
|
| 11 |
+
|
| 12 |
+
## Quick start on Hugging Face
|
| 13 |
+
|
| 14 |
+
1. Create a **GPU Space / Notebook** (or any cloud VM) with Python 3.10+.
|
| 15 |
+
2. Clone this conversion repo:
|
| 16 |
+
```bash
|
| 17 |
+
git clone https://huggingface.co/apoapps/apochat-gemma4-e2b-litert-conversion
|
| 18 |
+
cd apochat-gemma4-e2b-litert-conversion
|
| 19 |
+
```
|
| 20 |
+
3. Install dependencies:
|
| 21 |
+
```bash
|
| 22 |
+
pip install -r requirements.txt
|
| 23 |
+
```
|
| 24 |
+
4. Run the export:
|
| 25 |
+
```bash
|
| 26 |
+
python export_apochat_litert.py \
|
| 27 |
+
--mlx-repo apoapps/apochat-gemma4-e2b-apochat-tuned-v1 \
|
| 28 |
+
--upload-repo apoapps/apochat-gemma4-e2b-apochat-tuned-v1-litert
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
The script will:
|
| 32 |
+
- download the MLX-q4 fused snapshot,
|
| 33 |
+
- dequantize it to bfloat16 PyTorch safetensors,
|
| 34 |
+
- run `litert convert` with weight-only int4 quantization,
|
| 35 |
+
- upload the resulting `.litertlm` to the `--upload-repo`.
|
| 36 |
+
|
| 37 |
+
## Output
|
| 38 |
+
|
| 39 |
+
When it finishes, the artifact will be available at:
|
| 40 |
+
|
| 41 |
+
```
|
| 42 |
+
https://huggingface.co/apoapps/apochat-gemma4-e2b-apochat-tuned-v1-litert
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
Use that URL/revision/SHA to add the entry to `Apochat/Sources/LocalAI/Catalog/BundledCatalog.swift`.
|