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
Clean up
#8
by hvt4 - opened
- README.md +12 -13
- minicpm_dynamic_wi8_afp32_gpu_opt.litertlm +0 -3
README.md
CHANGED
|
@@ -24,24 +24,23 @@ This repository hosts the [**LiteRT-LM**](https://ai.google.dev/edge/litert-lm)
|
|
| 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 |
* **`MiniCPM5-1B_dynamic_wi8_afp32.litertlm`**: This model features dynamic weight-only INT8 quantization (wi8) with FP32 activations (afp32). It is configured with static prefill memory allocation.
|
| 30 |
|
| 31 |
## Quantization Benchmark
|
| 32 |
|
| 33 |
-
The table below compares the accuracy of the FP baseline and the
|
| 34 |
|
| 35 |
-
| Category | FP (bf16) |
|
| 36 |
-
| --- | --- | --- |
|
| 37 |
-
| Overall | 66.16 |
|
| 38 |
-
| STEM | 58.07 |
|
| 39 |
-
| Social Science | 77.91 |
|
| 40 |
-
| Humanities | 67.65 |
|
| 41 |
-
| Other | 68.71 |
|
| 42 |
-
| Hard | 47.08 |
|
| 43 |
|
| 44 |
-
FP (bf16) is the full-precision baseline.
|
| 45 |
|
| 46 |
## What is MiniCPM?
|
| 47 |
|
|
@@ -75,7 +74,7 @@ FP (bf16) is the full-precision baseline. W8 uses dynamic weight-only INT8 quant
|
|
| 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
|
| 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,7 +86,7 @@ Install `uv` and run the model directly from the LiteRT-LM command line:
|
|
| 87 |
|
| 88 |
```bash
|
| 89 |
uv tool install litert-lm
|
| 90 |
-
uvx litert-lm run --from-huggingface-repo=litert-community/MiniCPM5-1B
|
| 91 |
```
|
| 92 |
|
| 93 |
## Links
|
|
|
|
| 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 |
* **`MiniCPM5-1B_dynamic_wi8_afp32.litertlm`**: This model features dynamic weight-only INT8 quantization (wi8) with FP32 activations (afp32). It is configured with static prefill memory allocation.
|
| 29 |
|
| 30 |
## Quantization Benchmark
|
| 31 |
|
| 32 |
+
The table below compares the accuracy of the FP baseline and the LiteRT-LM quantized model on the same evaluation benchmark. Scores are reported as percentages.
|
| 33 |
|
| 34 |
+
| Category | FP (bf16) | W4 |
|
| 35 |
+
| --- | --- | --- |
|
| 36 |
+
| Overall | 66.16 | 60.91 |
|
| 37 |
+
| STEM | 58.07 | 53.36 |
|
| 38 |
+
| Social Science | 77.91 | 70.87 |
|
| 39 |
+
| Humanities | 67.65 | 64.35 |
|
| 40 |
+
| Other | 68.71 | 62.14 |
|
| 41 |
+
| Hard | 47.08 | 44.23 |
|
| 42 |
|
| 43 |
+
FP (bf16) is the full-precision baseline. 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. All evaluations use a temperature of 0.6, top-p of 0.95, and a random seed of 0.
|
| 44 |
|
| 45 |
## What is MiniCPM?
|
| 46 |
|
|
|
|
| 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 MiniCPM5-1B_dynamic_wi8_afp32.litertlm /sdcard/Download/`). Then, select this option, choose the downloaded file from your storage, configure your preferred parameters, and tap **"Import"**.
|
| 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 |
|
| 87 |
```bash
|
| 88 |
uv tool install litert-lm
|
| 89 |
+
uvx litert-lm run --from-huggingface-repo=litert-community/MiniCPM5-1B MiniCPM5-1B_dynamic_wi8_afp32.litertlm --prompt="What is the capital of France?"
|
| 90 |
```
|
| 91 |
|
| 92 |
## Links
|
minicpm_dynamic_wi8_afp32_gpu_opt.litertlm
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:ca61f7ccf2d34619f16f68155367e42ba5f38b29cd4c0e89b5548d35461308c4
|
| 3 |
-
size 1098475296
|
|
|
|
|
|
|
|
|
|
|
|