Instructions to use litert-community/SmolLM2-1.7B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use litert-community/SmolLM2-1.7B-Instruct with LiteRT-LM:
# LiteRT-LM runs on various platforms (Android, iOS, Windows, Linux, macOS, IoT, Web/WASM) # and supports many APIs (C++, Python, Kotlin, Swift, JavaScript, Flutter). # For platform-specific integration guides, please refer to the official developer website: # https://ai.google.dev/edge/litert-lm # To try LiteRT-LM, the easiest way is to use our CLI tool. # 1. Install the LiteRT-LM CLI tool: pip install -U litert-lm # 2. Download and run this model locally: # See: https://ai.google.dev/edge/litert-lm/cli # A single .litertlm file in the repo is picked automatically; otherwise the CLI asks which one to run # (or pass its name right after the repo id). litert-lm run \ --from-huggingface-repo=litert-community/SmolLM2-1.7B-Instruct \ --prompt="Write me a poem"
- LiteRT
How to use litert-community/SmolLM2-1.7B-Instruct with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Add model card and model.
#1
by hvt4 - opened
- .gitattributes +1 -0
- README.md +43 -0
- SmolLM2-1_7B-Instruct_dynamic_wi8_afp32.litertlm +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.litertlm filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: HuggingFaceTB/SmolLM2-1.7B-Instruct
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
library_name: litert-lm
|
| 6 |
+
tags:
|
| 7 |
+
- chat
|
| 8 |
+
- litert
|
| 9 |
+
- litert-lm
|
| 10 |
+
- litertlm
|
| 11 |
+
- on-device
|
| 12 |
+
- edge-ai
|
| 13 |
+
- smollm
|
| 14 |
+
- smollm2
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# SmolLM2-1.7B-Instruct (LiteRT-LM)
|
| 18 |
+
This repository hosts the [**LiteRT-LM**](https://github.com/google-ai-edge/LiteRT-LM) (LiteRT, formerly known as TensorFlow Lite) version of [**HuggingFaceTB/SmolLM2-1.7B-Instruct**](https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct), optimized for on-device inference across Android, desktop, and edge hardware.
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
## Available Models
|
| 22 |
+
* **`SmolLM2-1_7B-Instruct_dynamic_wi8_afp32.litertlm`**:
|
| 23 |
+
* **Quantization**: Dynamic weight-only INT8 quantization (`wi8`) with FP32 activations (`afp32`).
|
| 24 |
+
* **Hardware Optimization**: Converted via [`litert-torch`](https://github.com/google-ai-edge/litert-torch) with boolean attention masks and fused GPU composite operations enabled for high-throughput GPU and CPU execution.
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
## Use the Model
|
| 28 |
+
### 1. Edge Gallery App (Android)
|
| 29 |
+
You can run this model directly on Android using the official **[Google AI Edge Gallery](https://github.com/google-ai-edge/gallery)** app:
|
| 30 |
+
1. **Get the App**: Install the [app](https://play.google.com/store/apps/details?id=com.google.ai.edge.gallery&pli=1) from Google Play or download the latest APK from the [GitHub releases page](https://github.com/google-ai-edge/gallery/releases).
|
| 31 |
+
2. **Import the Model**: Navigate to the **Model manager** within the app and tap the **"+" (plus)** icon in the bottom-right corner:
|
| 32 |
+
* **Import from HF (Recommended)**: Select this option, enter `litert-community/SmolLM2-1.7B-Instruct`, and submit to download directly inside the app.
|
| 33 |
+
* **From local model file**: Download `SmolLM2-1_7B-Instruct_dynamic_wi8_afp32.litertlm` directly to your Android device (or push it via ADB: `adb push SmolLM2-1_7B-Instruct_dynamic_wi8_afp32.litertlm /sdcard/Download/`), select the file from storage, choose your preferred backend (**GPU** or **CPU**), and tap **"Import"**.
|
| 34 |
+
For full details on importing models and building from source, see the [Edge Gallery App Wiki](https://github.com/google-ai-edge/gallery/wiki).
|
| 35 |
+
|
| 36 |
+
### 2. Try It (Desktop / CLI)
|
| 37 |
+
Install `uv` and run the model directly from the [LiteRT-LM command line](https://github.com/google-ai-edge/LiteRT-LM):
|
| 38 |
+
```bash
|
| 39 |
+
uv tool install litert-lm
|
| 40 |
+
uvx litert-lm run \
|
| 41 |
+
--from-huggingface-repo=litert-community/SmolLM2-1.7B-Instruct \
|
| 42 |
+
SmolLM2-1_7B-Instruct_dynamic_wi8_afp32.litertlm \
|
| 43 |
+
--prompt="What is the capital of France?"
|
SmolLM2-1_7B-Instruct_dynamic_wi8_afp32.litertlm
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3c3e693157e2fb92b862b572cff74b7a353f81eb232cef682bf0fcc91855f8f1
|
| 3 |
+
size 1730949280
|