Instructions to use litert-community/MiniCPM-V-4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/MiniCPM-V-4 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
Update MiniCPM-V-4 model to be compatible with LiteRT-LM runtime at HEAD
#6
by yichunkuo - opened
- MiniCPM-V-4-int8.litertlm +1 -1
- README.md +37 -5
MiniCPM-V-4-int8.litertlm
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4214021104
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d45ef0cd8141597d731d002b72a152ab1a0f8b9cda8d9a0f5e1bc3a4689dcbd0
|
| 3 |
size 4214021104
|
README.md
CHANGED
|
@@ -56,16 +56,48 @@ Full MME evaluation running the INT8 bundle on-device:
|
|
| 56 |
|
| 57 |
## Usage
|
| 58 |
|
| 59 |
-
Run with
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
```bash
|
| 62 |
-
|
| 63 |
-
--model_path=./MiniCPM-V-4-int8.litertlm \
|
| 64 |
--backend=cpu \
|
| 65 |
-
--
|
| 66 |
-
--
|
|
|
|
| 67 |
```
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
## License
|
| 70 |
|
| 71 |
Follows the license of the base model — see **https://huggingface.co/openbmb/MiniCPM-V-4**.
|
|
|
|
| 56 |
|
| 57 |
## Usage
|
| 58 |
|
| 59 |
+
### Run with `litert_lm_advanced_main`
|
| 60 |
+
|
| 61 |
+
You can run multimodal inference using `litert_lm_advanced_main` from the [LiteRT-LM](https://github.com/google-ai-edge/LiteRT-LM) repository. `litert_lm_advanced_main` supports inline media markers (such as `[image:/path/to/image.png]`) within `--input_prompt`.
|
| 62 |
+
|
| 63 |
+
#### 1. Build the Runner
|
| 64 |
+
|
| 65 |
+
From the LiteRT-LM repository:
|
| 66 |
+
|
| 67 |
+
```bash
|
| 68 |
+
bazel build -c opt //runtime/engine:litert_lm_advanced_main
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
#### 2. Run Inference
|
| 72 |
+
|
| 73 |
+
Using `bazel run`:
|
| 74 |
|
| 75 |
```bash
|
| 76 |
+
bazel run -c opt //runtime/engine:litert_lm_advanced_main -- \
|
|
|
|
| 77 |
--backend=cpu \
|
| 78 |
+
--vision_backend=cpu \
|
| 79 |
+
--model_path=/path/to/MiniCPM-V-4-int8.litertlm \
|
| 80 |
+
--input_prompt="What is in this image? [image:/path/to/image.png]"
|
| 81 |
```
|
| 82 |
|
| 83 |
+
Or execute the compiled binary directly:
|
| 84 |
+
|
| 85 |
+
```bash
|
| 86 |
+
./bazel-bin/runtime/engine/litert_lm_advanced_main \
|
| 87 |
+
--backend=cpu \
|
| 88 |
+
--vision_backend=cpu \
|
| 89 |
+
--model_path=/path/to/MiniCPM-V-4-int8.litertlm \
|
| 90 |
+
--input_prompt="What is in this image? [image:/path/to/image.png]"
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
#### Key Options
|
| 94 |
+
|
| 95 |
+
- `--backend=cpu`: Runs LLM prefill and decode on CPU.
|
| 96 |
+
- `--vision_backend=cpu`: Enables the vision modality and runs the SigLIP vision encoder on CPU.
|
| 97 |
+
- `--input_prompt`: Prompt text including image path using `[image:/path/to/image.png]`.
|
| 98 |
+
- `--max_output_tokens`: (Optional) Limit the maximum number of generated tokens (e.g. `--max_output_tokens=128`).
|
| 99 |
+
- `--min_log_severity=2`: (Optional) Display info logs, such as vision executor properties (`num_tokens_per_image: 64`, `patch_num_shrink_factor: 17`).
|
| 100 |
+
|
| 101 |
## License
|
| 102 |
|
| 103 |
Follows the license of the base model — see **https://huggingface.co/openbmb/MiniCPM-V-4**.
|