Instructions to use litert-community/MiniCPM5-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/MiniCPM5-1B 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 gpu optimized wi4b32_wi8_afp32 model
#9
by CarreyZhan - opened
- README.md +13 -12
- minicpm_wi4b32_wi8_afp32_gpu_opt.litertlm +3 -0
README.md
CHANGED
|
@@ -24,23 +24,24 @@ This repository hosts the [**LiteRT-LM**](https://ai.google.dev/edge/litert-lm)
|
|
| 24 |
|
| 25 |
## Available Models
|
| 26 |
|
|
|
|
| 27 |
* **`minicpm_wi4b32_wi8_afp32.litertlm`**: This model features mixed INT4-block32(linear)/INT8(embed and lmhead) quantization (wi4b32_wi8) with FP32 activations (afp32).
|
| 28 |
-
* **`
|
| 29 |
|
| 30 |
## Quantization Benchmark
|
| 31 |
|
| 32 |
-
The table below compares the accuracy of the
|
| 33 |
|
| 34 |
-
| Category |
|
| 35 |
| --- | --- | --- |
|
| 36 |
-
| Overall |
|
| 37 |
-
| STEM |
|
| 38 |
-
| Social Science |
|
| 39 |
-
| Humanities |
|
| 40 |
-
| Other |
|
| 41 |
-
| Hard |
|
| 42 |
|
| 43 |
-
|
| 44 |
|
| 45 |
## What is MiniCPM?
|
| 46 |
|
|
@@ -74,7 +75,7 @@ FP (bf16) is the full-precision baseline. W4 uses mixed INT4-block32 (linear) /
|
|
| 74 |
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).
|
| 75 |
2. **Importing the Model**: Navigate to the **Model manager** within the app and click the **"+" (plus)** icon in the bottom-right corner. Two options will appear:
|
| 76 |
* **Import from HF (Recommended)**: Select this option, and a dialog box will appear showing an example Hugging Face model URL. Enter the HF link for the desired `.litertlm` model and click submit. The model will then appear in your list, and you can proceed to download it (a Hugging Face account login is required).
|
| 77 |
-
* **From local model file**: First, download the `.litertlm` model directly to your Android device, OR download it to your computer and push it via ADB (e.g., `adb push
|
| 78 |
|
| 79 |
For full details on importing models and other features, see the [Edge Gallery App Wiki](https://github.com/google-ai-edge/gallery/wiki).
|
| 80 |
|
|
@@ -86,7 +87,7 @@ Install `uv` and run the model directly from the LiteRT-LM command line:
|
|
| 86 |
|
| 87 |
```bash
|
| 88 |
uv tool install litert-lm
|
| 89 |
-
uvx litert-lm run --from-huggingface-repo=litert-community/MiniCPM5-1B
|
| 90 |
```
|
| 91 |
|
| 92 |
## Links
|
|
|
|
| 24 |
|
| 25 |
## Available Models
|
| 26 |
|
| 27 |
+
* **`minicpm_dynamic_wi8_afp32_gpu_opt.litertlm`**: This model features dynamic weight-only INT8 quantization (wi8) with FP32 activations (afp32), heavily optimized for GPU execution.
|
| 28 |
* **`minicpm_wi4b32_wi8_afp32.litertlm`**: This model features mixed INT4-block32(linear)/INT8(embed and lmhead) quantization (wi4b32_wi8) with FP32 activations (afp32).
|
| 29 |
+
* **`minicpm_wi4b32_wi8_afp32_gpu_opt.litertlm`**: This model uses same quantization recipe with minicpm_wi4b32_wi8_afp32 but optimized for GPU execution.
|
| 30 |
|
| 31 |
## Quantization Benchmark
|
| 32 |
|
| 33 |
+
The table below compares the accuracy of the LiteRT-LM quantized models on the same evaluation benchmark. Scores are reported as percentages.
|
| 34 |
|
| 35 |
+
| Category | W8 (`minicpm_dynamic_wi8_afp32_gpu_opt.litertlm`) | W4 (`minicpm_wi4b32_wi8_afp32.litertlm`) |
|
| 36 |
| --- | --- | --- |
|
| 37 |
+
| Overall | 63.78 | 60.91 |
|
| 38 |
+
| STEM | 56.35 | 53.36 |
|
| 39 |
+
| Social Science | 73.65 | 70.87 |
|
| 40 |
+
| Humanities | 66.68 | 64.35 |
|
| 41 |
+
| Other | 65.40 | 62.14 |
|
| 42 |
+
| Hard | 43.79 | 44.23 |
|
| 43 |
|
| 44 |
+
W8 uses dynamic weight-only INT8 quantization (`wi8`) with FP32 activations (`afp32`). W4 uses mixed INT4-block32 (linear) / INT8 (embed and lmhead) quantization (`wi4b32_wi8`) with FP32 activations (`afp32`). Thinking mode has been turned off to reduce context usage.
|
| 45 |
|
| 46 |
## What is MiniCPM?
|
| 47 |
|
|
|
|
| 75 |
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).
|
| 76 |
2. **Importing the Model**: Navigate to the **Model manager** within the app and click the **"+" (plus)** icon in the bottom-right corner. Two options will appear:
|
| 77 |
* **Import from HF (Recommended)**: Select this option, and a dialog box will appear showing an example Hugging Face model URL. Enter the HF link for the desired `.litertlm` model and click submit. The model will then appear in your list, and you can proceed to download it (a Hugging Face account login is required).
|
| 78 |
+
* **From local model file**: First, download the `.litertlm` model directly to your Android device, OR download it to your computer and push it via ADB (e.g., `adb push minicpm_dynamic_wi8_afp32_gpu_opt.litertlm /sdcard/Download/`). Then, select this option, choose the downloaded file from your storage, configure your preferred parameters, and tap **"Import"**.
|
| 79 |
|
| 80 |
For full details on importing models and other features, see the [Edge Gallery App Wiki](https://github.com/google-ai-edge/gallery/wiki).
|
| 81 |
|
|
|
|
| 87 |
|
| 88 |
```bash
|
| 89 |
uv tool install litert-lm
|
| 90 |
+
uvx litert-lm run --from-huggingface-repo=litert-community/MiniCPM5-1B minicpm_dynamic_wi8_afp32_gpu_opt.litertlm --prompt="What is the capital of France?"
|
| 91 |
```
|
| 92 |
|
| 93 |
## Links
|
minicpm_wi4b32_wi8_afp32_gpu_opt.litertlm
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e15a7cc735ae36e9888d341d44bd53c0579153d7a3379aaf958620eea4816e3
|
| 3 |
+
size 793034752
|