Instructions to use spybyscript/gliner25-decide-litert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use spybyscript/gliner25-decide-litert 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
- GLiNER2
How to use spybyscript/gliner25-decide-litert with GLiNER2:
from gliner2 import AutoExtractor extractor = AutoExtractor.from_pretrained("spybyscript/gliner25-decide-litert") # Extract entities text = "Apple CEO Tim Cook announced iPhone 15 in Cupertino yesterday." result = extractor.extract_entities(text, ["company", "person", "product", "location"]) print(result) - Notebooks
- Google Colab
- Kaggle
Galaxy Z Fold 8 results beside the S23's; GPU priority depends on the GPU
Browse files- README.md +50 -24
- SHA256SUMS +2 -2
- npu/manifest.json +3 -3
README.md
CHANGED
|
@@ -59,9 +59,9 @@ LiteRT. Schema handling, scoring and decoding are the library's own code.
|
|
| 59 |
3. Call the smallest signature that holds the request.
|
| 60 |
4. For classification, read each task's `[L]` marker positions from `logits`.
|
| 61 |
|
| 62 |
-
GPU settings: set the precision explicitly (FP32 for `wfp16`, FP16 for `fp16hw`)
|
| 63 |
-
|
| 64 |
-
precompiled file.
|
| 65 |
|
| 66 |
**Fixed sizes.** The original runs with dynamic shapes; this conversion has fixed limits:
|
| 67 |
- a request holds at most 512 tokens (schema and text);
|
|
@@ -92,13 +92,34 @@ Every tensor is [1, rows, features], the shapes LiteRT's GPU delegate accepts.
|
|
| 92 |
|
| 93 |
`validation-full.json` and `validation.json` hold the numbers.
|
| 94 |
|
| 95 |
-
##
|
| 96 |
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
|
|
|
| 100 |
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|---|---|---|---|---|
|
| 103 |
| encoder, 128 / 160 / 256 / 512 tokens | 628 / 866 / 1,467 / 3,486 ms | 103 / 124 / 227 / 773 ms | 202 / 268 / 471 / 1,549 ms | 34 / 55 / 168 / 1,149 ms |
|
| 104 |
| span file `w64` / `w128` / `w256` / `w512` | 43 / 105 / 221 / 450 ms | 10 / 15 / 25 / 47 ms | 19 / 26 / 42 / 79 ms | 7.3 / 6.0 / 14 / 42 ms |
|
|
@@ -107,26 +128,31 @@ whole calls. CPU and NPU times are the model alone.
|
|
| 107 |
| classifier, 32 / 128 rows | 0.9 / 3.8 ms | 1.2 / 1.5 ms | 1.6 / 2.4 ms | 0.8 / 1.3 ms |
|
| 108 |
| dirty memory, encoder / span file | 1.9 / 1.7 GB | 2.7 / 0.8 GB | 4.6 / 1.3 GB | 0.12 / 0.21 GB |
|
| 109 |
|
| 110 |
-
- **The NPU's 512-token time** comes from the classification file; the hidden-state file stops at 256 tokens.
|
| 111 |
- **An extraction request** (up to 128 tokens and 64 words) takes about 43 ms on the NPU. On the GPU it takes about
|
| 112 |
115 ms at FP16 and 220 ms at FP32; on the CPU, about 660 ms.
|
| 113 |
-
- **Loading:**
|
| 114 |
-
- **Answers with the phone's outputs
|
| 115 |
- the encoder: unchanged on the NPU, at GPU FP32 and on the CPU; at GPU FP16, 31 of 32 (one relation request changed);
|
| 116 |
-
- the span file: unchanged
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
three classification calls each round (`s160` and two `s256`, `fp16hw` at FP16):
|
| 120 |
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
-
|
| 129 |
-
|
|
|
|
|
|
|
| 130 |
|
| 131 |
## Qualcomm NPU files (`npu/`)
|
| 132 |
|
|
@@ -148,7 +174,7 @@ The NPU path runs through LiteRT's Qualcomm accelerator:
|
|
| 148 |
|
| 149 |
| Chip | Snapdragon | Hexagon | Run on a phone |
|
| 150 |
|---|---|---|---|
|
| 151 |
-
| SM8850 | 8 Elite Gen 5 | V81 |
|
| 152 |
| SM8750 | 8 Elite | V79 | not yet |
|
| 153 |
| SM8650 | 8 Gen 3 | V75 | not yet |
|
| 154 |
| SM8550 | 8 Gen 2 | V73 | all four files (Galaxy S23 Ultra, the results above) |
|
|
|
|
| 59 |
3. Call the smallest signature that holds the request.
|
| 60 |
4. For classification, read each task's `[L]` marker positions from `logits`.
|
| 61 |
|
| 62 |
+
GPU settings: set the precision explicitly (FP32 for `wfp16`, FP16 for `fp16hw`) and turn on constant tensor sharing.
|
| 63 |
+
The right priority depends on the GPU; see "GPU priority" below. On the CPU, set XNNPACK's weight cache path. On a
|
| 64 |
+
Snapdragon NPU, load the chip's precompiled file.
|
| 65 |
|
| 66 |
**Fixed sizes.** The original runs with dynamic shapes; this conversion has fixed limits:
|
| 67 |
- a request holds at most 512 tokens (schema and text);
|
|
|
|
| 92 |
|
| 93 |
`validation-full.json` and `validation.json` hold the numbers.
|
| 94 |
|
| 95 |
+
## Phones
|
| 96 |
|
| 97 |
+
LiteRT 2.3.2 with `qnn-runtime` 2.50.0. Each graph ran on a request recorded from the corpus: 10 calls after a rest, at
|
| 98 |
+
thermal status 0. The CPU ran 4 threads; the GPU ran at NORMAL priority, timed as whole calls. CPU and NPU times are the
|
| 99 |
+
model alone. The NPU rows use the chip's precompiled files; at 512 tokens they use the classification file, because the
|
| 100 |
+
hidden-state file stops at 256.
|
| 101 |
|
| 102 |
+
### Galaxy Z Fold 8 (SM8850, Snapdragon 8 Elite Gen 5, Android 17)
|
| 103 |
+
|
| 104 |
+
| Graph | CPU | GPU FP16 (`fp16hw`) | GPU FP32 (`wfp16`) | NPU |
|
| 105 |
+
|---|---|---|---|---|
|
| 106 |
+
| encoder, 128 / 160 / 256 / 512 tokens | 115 / 145 / 262 / 722 ms | 60 / 72 / 121 / 404 ms | 105 / 137 / 214 / 610 ms | 23 / 30 / 95 / 644 ms |
|
| 107 |
+
| span file `w64` / `w128` / `w256` / `w512` | 10 / 20 / 38 / 77 ms | 5.3 / 7.1 / 12 / 24 ms | 9.5 / 14 / 35 / 76 ms | 7.0 / 4.4 / 8.7 / 31 ms |
|
| 108 |
+
| fused scores `f64` … `f512`, 16 queries | 6.4 / 14 / 30 / 55 ms | 4.4 / 5.4 / 7.9 / 15 ms | 7.6 / 10 / 16 / 27 ms | 3.1 / 3.9 / 8.2 / 33 ms |
|
| 109 |
+
| count embedding, 1 step × 8 fields / 20 × 32 | 1.5 / 37 ms | not supported by LiteRT's GPU | not supported | 0.9 / 2.6 ms |
|
| 110 |
+
| classifier, 32 / 128 rows | 0.2 / 0.8 ms | 0.5 / 0.6 ms | 1.0 / 1.0 ms | 0.5 / 0.8 ms |
|
| 111 |
+
| dirty memory, encoder / span file | 2.3 / 1.4 GB | 2.8 / 0.8 GB | 4.8 / 1.4 GB | 0.14 / 0.19 GB |
|
| 112 |
+
|
| 113 |
+
- **An extraction request** (up to 128 tokens and 64 words) takes about 35 ms on the NPU. On the GPU it takes about
|
| 114 |
+
70 ms at FP16 and 125 ms at FP32; on the CPU, about 135 ms.
|
| 115 |
+
- **Loading:** the precompiled NPU files load in 0.3–1.0 s; the encoder's first GPU load takes 11–13 s.
|
| 116 |
+
- **Answers with the phone's outputs:**
|
| 117 |
+
- the encoder: unchanged on the CPU and at GPU FP32 and FP16; on the NPU, 31 of 32 (one family-relation request changed);
|
| 118 |
+
- the span file and the heads file: unchanged on the GPU and the NPU.
|
| 119 |
+
|
| 120 |
+
### Galaxy S23 Ultra (SM8550, Snapdragon 8 Gen 2, Android 16)
|
| 121 |
+
|
| 122 |
+
| Graph | CPU | GPU FP16 (`fp16hw`) | GPU FP32 (`wfp16`) | NPU |
|
| 123 |
|---|---|---|---|---|
|
| 124 |
| encoder, 128 / 160 / 256 / 512 tokens | 628 / 866 / 1,467 / 3,486 ms | 103 / 124 / 227 / 773 ms | 202 / 268 / 471 / 1,549 ms | 34 / 55 / 168 / 1,149 ms |
|
| 125 |
| span file `w64` / `w128` / `w256` / `w512` | 43 / 105 / 221 / 450 ms | 10 / 15 / 25 / 47 ms | 19 / 26 / 42 / 79 ms | 7.3 / 6.0 / 14 / 42 ms |
|
|
|
|
| 128 |
| classifier, 32 / 128 rows | 0.9 / 3.8 ms | 1.2 / 1.5 ms | 1.6 / 2.4 ms | 0.8 / 1.3 ms |
|
| 129 |
| dirty memory, encoder / span file | 1.9 / 1.7 GB | 2.7 / 0.8 GB | 4.6 / 1.3 GB | 0.12 / 0.21 GB |
|
| 130 |
|
|
|
|
| 131 |
- **An extraction request** (up to 128 tokens and 64 words) takes about 43 ms on the NPU. On the GPU it takes about
|
| 132 |
115 ms at FP16 and 220 ms at FP32; on the CPU, about 660 ms.
|
| 133 |
+
- **Loading:** the precompiled NPU files load in 0.5–1.7 s; the encoder's first GPU load takes 6–10 s.
|
| 134 |
+
- **Answers with the phone's outputs:**
|
| 135 |
- the encoder: unchanged on the NPU, at GPU FP32 and on the CPU; at GPU FP16, 31 of 32 (one relation request changed);
|
| 136 |
+
- the span file and the heads file: unchanged on the GPU and the NPU.
|
| 137 |
+
|
| 138 |
+
Each answer check ran 32 recorded requests (two per call type) with the phone's outputs through the rest of the pipeline.
|
|
|
|
| 139 |
|
| 140 |
+
### GPU priority beside a rendering app
|
| 141 |
+
|
| 142 |
+
An app rendered every frame (Godot 4.7, Vulkan) while the model ran three classification calls each round (`s160` and two
|
| 143 |
+
`s256`, `fp16hw` at GPU FP16). Each cell gives the app's longest frame per round (median) and the three calls' total time.
|
| 144 |
+
|
| 145 |
+
| The model on | Galaxy Z Fold 8 (Adreno 840, 60 Hz) | Galaxy S23 Ultra (Adreno 740, 120 Hz) |
|
| 146 |
+
|---|---|---|
|
| 147 |
+
| GPU, LOW priority | **37 ms**, 0.66 s | 600 ms, 1.6 s |
|
| 148 |
+
| GPU, NORMAL priority | 110 ms, 0.37 s | **228 ms**, 0.65 s |
|
| 149 |
+
| NPU | 39 ms, 0.24 s | 81 ms, 0.5 s |
|
| 150 |
+
| CPU | 41 ms, 0.81 s | 48 ms, 4–5 s |
|
| 151 |
|
| 152 |
+
- **LOW priority depends on the GPU.** On the Fold's Adreno 840, LOW keeps the frames and costs about 0.3 s per round. On
|
| 153 |
+
the S23's Adreno 740, LOW does not let the app's rendering in, and only makes each call longer.
|
| 154 |
+
- **Measure on the target GPU before choosing.** Use the smallest signature that fits.
|
| 155 |
+
- **The NPU keeps the frames on both phones** and is the fastest option.
|
| 156 |
|
| 157 |
## Qualcomm NPU files (`npu/`)
|
| 158 |
|
|
|
|
| 174 |
|
| 175 |
| Chip | Snapdragon | Hexagon | Run on a phone |
|
| 176 |
|---|---|---|---|
|
| 177 |
+
| SM8850 | 8 Elite Gen 5 | V81 | all four files (Galaxy Z Fold 8, the results above) |
|
| 178 |
| SM8750 | 8 Elite | V79 | not yet |
|
| 179 |
| SM8650 | 8 Gen 3 | V75 | not yet |
|
| 180 |
| SM8550 | 8 Gen 2 | V73 | all four files (Galaxy S23 Ultra, the results above) |
|
SHA256SUMS
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
|
| 2 |
c810d9c1789eef9890a1844136e77a9fb475c950df02a19ffdf3ecbbc50ec7be NOTICE.txt
|
| 3 |
-
|
| 4 |
98e61f6cec59c2238b2a80c4d3e829de88ba570ebd7ab22187672caa6737d9e7 config.json
|
| 5 |
43a132d3571d4a028013990f4866e266d01e35394819d89cbb1cd24d558608bc gliner25_decide_count_wfp16.tflite
|
| 6 |
f90f5d837721b3d4df7194a89ea18bbea5c449e6944fb6078664f1a8d20484fd gliner25_decide_embeddings_f16.bin
|
|
@@ -12,7 +12,7 @@ ce29834da27c7ddacc74e5ebb560c9104e1b83d04a8ba8dd82059737e9dbd419 model-card.md
|
|
| 12 |
323e3f48ad74ba4110f69c58d40d8e2f55e5f1b9723cfb82c30c2a622be86f7a npu/gliner25_decide_fp16hw_s128.tflite
|
| 13 |
1783d73131c2395c3e39e6364536e2f9643b4c1eba3051db21b4cd91a868e0ed npu/gliner25_decide_fp16hw_s160.tflite
|
| 14 |
08fbd3820bace55861948c392a130ab934895d2d75a54e7e1666aabdf0ba16e1 npu/gliner25_decide_fp16hw_s256.tflite
|
| 15 |
-
|
| 16 |
b82f3b26b9cd9ce59ea1340486e81bec51a4aae6fcb7b5ff7769b717326dc32a npu/qualcomm/gliner25_decide_fp16hw_SM8450.tflite
|
| 17 |
86bfd5ca3aea9075dcb0482c04572dcfd247f2f6f3bb040ac0d989d8e60ed6bd npu/qualcomm/gliner25_decide_fp16hw_SM8550.tflite
|
| 18 |
48a382ae593afe724eb40b833991b5c8fb8dbb2bb6b14c74ebf9abb862177e02 npu/qualcomm/gliner25_decide_fp16hw_SM8650.tflite
|
|
|
|
| 1 |
cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
|
| 2 |
c810d9c1789eef9890a1844136e77a9fb475c950df02a19ffdf3ecbbc50ec7be NOTICE.txt
|
| 3 |
+
c0acb7d4fdc909f4f6cb35b9e42c74e0e34d5b8390059d3b8e7eb889689664f5 README.md
|
| 4 |
98e61f6cec59c2238b2a80c4d3e829de88ba570ebd7ab22187672caa6737d9e7 config.json
|
| 5 |
43a132d3571d4a028013990f4866e266d01e35394819d89cbb1cd24d558608bc gliner25_decide_count_wfp16.tflite
|
| 6 |
f90f5d837721b3d4df7194a89ea18bbea5c449e6944fb6078664f1a8d20484fd gliner25_decide_embeddings_f16.bin
|
|
|
|
| 12 |
323e3f48ad74ba4110f69c58d40d8e2f55e5f1b9723cfb82c30c2a622be86f7a npu/gliner25_decide_fp16hw_s128.tflite
|
| 13 |
1783d73131c2395c3e39e6364536e2f9643b4c1eba3051db21b4cd91a868e0ed npu/gliner25_decide_fp16hw_s160.tflite
|
| 14 |
08fbd3820bace55861948c392a130ab934895d2d75a54e7e1666aabdf0ba16e1 npu/gliner25_decide_fp16hw_s256.tflite
|
| 15 |
+
9dfc7fbb9ac0afea880d294cddb7b909caa87771ed5bd06449228331ebdb3344 npu/manifest.json
|
| 16 |
b82f3b26b9cd9ce59ea1340486e81bec51a4aae6fcb7b5ff7769b717326dc32a npu/qualcomm/gliner25_decide_fp16hw_SM8450.tflite
|
| 17 |
86bfd5ca3aea9075dcb0482c04572dcfd247f2f6f3bb040ac0d989d8e60ed6bd npu/qualcomm/gliner25_decide_fp16hw_SM8550.tflite
|
| 18 |
48a382ae593afe724eb40b833991b5c8fb8dbb2bb6b14c74ebf9abb862177e02 npu/qualcomm/gliner25_decide_fp16hw_SM8650.tflite
|
npu/manifest.json
CHANGED
|
@@ -138,7 +138,7 @@
|
|
| 138 |
"bytes": 792047904,
|
| 139 |
"sha256": "d95903041604a96b4e68ff8afd17a1d71fc97a806e91ac73635dc152338f92c5",
|
| 140 |
"compileSeconds": 406.0,
|
| 141 |
-
"checkedOn":
|
| 142 |
},
|
| 143 |
{
|
| 144 |
"path": "npu/qualcomm/gliner25_decide_heads_SM8850.tflite",
|
|
@@ -164,7 +164,7 @@
|
|
| 164 |
"bytes": 115163440,
|
| 165 |
"sha256": "f582aeed6c4ed83dd74a96e485815fa819d5cf26b7fb1fdb3de1bba26ca8d483",
|
| 166 |
"compileSeconds": 76.3,
|
| 167 |
-
"checkedOn":
|
| 168 |
},
|
| 169 |
{
|
| 170 |
"path": "npu/qualcomm/gliner25_decide_fp16hw_se128-256_SM8750.tflite",
|
|
@@ -372,7 +372,7 @@
|
|
| 372 |
"bytes": 81475504,
|
| 373 |
"sha256": "47ff970ddafda7f643788d7bce883858667028e3ca1dc50e366a39c06e972b19",
|
| 374 |
"compileSeconds": 16.4,
|
| 375 |
-
"checkedOn":
|
| 376 |
},
|
| 377 |
{
|
| 378 |
"path": "npu/qualcomm/gliner25_decide_span_SM8750.tflite",
|
|
|
|
| 138 |
"bytes": 792047904,
|
| 139 |
"sha256": "d95903041604a96b4e68ff8afd17a1d71fc97a806e91ac73635dc152338f92c5",
|
| 140 |
"compileSeconds": 406.0,
|
| 141 |
+
"checkedOn": "Galaxy Z Fold 8, 2026-11-02"
|
| 142 |
},
|
| 143 |
{
|
| 144 |
"path": "npu/qualcomm/gliner25_decide_heads_SM8850.tflite",
|
|
|
|
| 164 |
"bytes": 115163440,
|
| 165 |
"sha256": "f582aeed6c4ed83dd74a96e485815fa819d5cf26b7fb1fdb3de1bba26ca8d483",
|
| 166 |
"compileSeconds": 76.3,
|
| 167 |
+
"checkedOn": "Galaxy Z Fold 8, 2026-11-02"
|
| 168 |
},
|
| 169 |
{
|
| 170 |
"path": "npu/qualcomm/gliner25_decide_fp16hw_se128-256_SM8750.tflite",
|
|
|
|
| 372 |
"bytes": 81475504,
|
| 373 |
"sha256": "47ff970ddafda7f643788d7bce883858667028e3ca1dc50e366a39c06e972b19",
|
| 374 |
"compileSeconds": 16.4,
|
| 375 |
+
"checkedOn": "Galaxy Z Fold 8, 2026-11-02"
|
| 376 |
},
|
| 377 |
{
|
| 378 |
"path": "npu/qualcomm/gliner25_decide_span_SM8750.tflite",
|