Update MiniCPM-V-4 model to be compatible with LiteRT-LM runtime at HEAD

#6
Files changed (2) hide show
  1. MiniCPM-V-4-int8.litertlm +1 -1
  2. 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:ae545078bdada2752a92eadd41a33d8ce86848b42faf9acb30bdaaaba8676a17
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 a LiteRT-LM CPU runner:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
  ```bash
62
- LD_LIBRARY_PATH=. ./litert_lm_main \
63
- --model_path=./MiniCPM-V-4-int8.litertlm \
64
  --backend=cpu \
65
- --image_path=./image.jpg \
66
- --input_prompt="What is in this image?"
 
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**.