dariofinardi commited on
Commit
51d4a15
Β·
verified Β·
1 Parent(s): 6b60c2f

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +25 -13
README.md CHANGED
@@ -13,38 +13,49 @@ tags:
13
  pipeline_tag: token-classification
14
  ---
15
 
16
- # GLiNER2 Multi-v1 (ONNX Fragmented)
17
 
18
  This repository contains the ONNX-exported weights for **GLiNER2-Multi-v1**.
19
  The model is specifically exported in a fragmented format (encoder, span_rep, count_pred, count_lstm, classifier) to be directly compatible with [gliner2-rs](https://github.com/SemplificaAI/gliner2-rs), the official Zero-Python Native Rust Inference Engine for GLiNER2.
20
 
 
 
 
 
 
 
 
 
 
 
21
  ## πŸš€ Performance & Benchmarks
22
 
23
  The ONNX conversion, combined with the Rust native engine (`ort` binding), allows this model to run extremely fast on both GPUs and edge devices like NPUs.
24
 
25
  **Benchmark Task:** Tested on complex text extraction tasks spanning up to 62 classes (metrics normalized per extracted entity to allow cross-device comparison).
26
 
27
- | Hardware | Execution Provider | Avg Time / Entity |
28
- | :--- | :--- | :--- |
29
- | **NVIDIA RTX 4090** | CUDA (FP16) | **~12.0 ms** πŸš€ |
30
- | **NVIDIA RTX 3090** | CUDA (FP16) | **~11.6 ms** πŸš€ |
31
- | **Qualcomm Snapdragon X Elite** | QNN (NPU Native) | **~22.78 ms** ✨ |
32
- | **Qualcomm Snapdragon X Elite** | CPU (ARM NEON) | **~28.62 ms** |
33
- | **AMD Ryzen 9 5900XT** (16-Core) | CPU (x86 AVX2) | **~30.16 ms** πŸ’» |
34
-
35
- *Note: The NPU matches high-end Desktop CPUs while consuming a fraction of the power!*
36
 
37
  ## πŸ“¦ Usage in Rust
38
 
39
- You can dynamically download and execute these ONNX weights from Rust in 3 lines of code:
40
 
41
  ```rust
42
  use gliner2_inference::{Gliner2Engine, ModelType, SchemaTask};
43
 
44
- // Auto-downloads the FP16 models from this HuggingFace repo
 
45
  let engine = Gliner2Engine::from_pretrained(
46
  "SemplificaAI/gliner2-multi-v1-onnx",
47
- Some("fp16"),
48
  ModelType::HuggingFace
49
  )?;
50
 
@@ -60,3 +71,4 @@ let (entities, _, _) = engine.extract(text, &tasks)?;
60
 
61
  ## πŸ”§ Model Fixes
62
  - `count_lstm` has been successfully exported with dynamic sequence unrolling by replacing the training `CompileSafeGRU` with native `nn.GRU`, resolving Out-of-Bounds `Gather` ONNX errors for variable length texts.
 
 
13
  pipeline_tag: token-classification
14
  ---
15
 
16
+ # GLiNER2 Multi-v1 (ONNX Fragmented & IOBinding)
17
 
18
  This repository contains the ONNX-exported weights for **GLiNER2-Multi-v1**.
19
  The model is specifically exported in a fragmented format (encoder, span_rep, count_pred, count_lstm, classifier) to be directly compatible with [gliner2-rs](https://github.com/SemplificaAI/gliner2-rs), the official Zero-Python Native Rust Inference Engine for GLiNER2.
20
 
21
+ ### πŸ†• Update: V2 Zero-Copy IOBinding Models Available!
22
+ We have introduced **V2 fused models** (`fp16_v2` and `fp32_v2`) that fuse `Gather`, `ArgMax`, and `MatMul` operations directly into the ONNX graph. By using ORT's `IoBinding`, these models ensure that tensors **never leave the GPU/NPU VRAM**, completely bypassing the PCIe bus and reducing inference latency by ~30% on discrete GPUs.
23
+
24
+ ## πŸ“‚ Available Variants
25
+
26
+ * **`fp16_v2`** *(Recommended)*: Zero-Copy VRAM optimized models. Fused operations with Full IO Types (native FP16). Drastically reduces inference time on NVIDIA CUDA, AMD ROCm, and Apple CoreML. Requires `gliner2-rs >= 0.4.1`.
27
+ * **`fp32_v2`**: High precision V2 fusions for CPU execution (AVX, XNNPACK). Requires `gliner2-rs >= 0.4.1`.
28
+ * **`fp16`** *(Standard)*: Legacy Float16 ONNX models. Slower on discrete GPUs due to PCIe transfers, but completely stable and supported everywhere.
29
+ * **`fp32`** *(Standard)*: Legacy Float32 ONNX models.
30
+
31
  ## πŸš€ Performance & Benchmarks
32
 
33
  The ONNX conversion, combined with the Rust native engine (`ort` binding), allows this model to run extremely fast on both GPUs and edge devices like NPUs.
34
 
35
  **Benchmark Task:** Tested on complex text extraction tasks spanning up to 62 classes (metrics normalized per extracted entity to allow cross-device comparison).
36
 
37
+ | Hardware | Execution Provider | Model Variant | Avg Time / Entity |
38
+ | :--- | :--- | :--- | :--- |
39
+ | **NVIDIA RTX 4090** | CUDA (V2 IOBinding) | `fp16_v2` | **~7.0 ms** ⚑ |
40
+ | **NVIDIA RTX 3090** | CUDA (V2 IOBinding) | `fp16_v2` | **~7.2 ms** ⚑ |
41
+ | **NVIDIA RTX 4090** | CUDA (V1 Standard) | `fp16` | **~12.0 ms** πŸš€ |
42
+ | **NVIDIA RTX 3090** | CUDA (V1 Standard) | `fp16` | **~11.6 ms** πŸš€ |
43
+ | **Qualcomm Snapdragon X Elite** | QNN (NPU Native) | `fp16` | **~22.78 ms** ✨ |
44
+ | **AMD Ryzen 9 5900XT** (16-Core) | CPU (x86 AVX2) | `fp32_v2` | **~20.6 ms** πŸ’» |
45
+ | **Qualcomm Snapdragon X Elite** | CPU (ARM NEON) | `fp32` | **~28.62 ms** |
46
 
47
  ## πŸ“¦ Usage in Rust
48
 
49
+ You can dynamically download and execute these ONNX weights from Rust in 3 lines of code. With `gliner2-rs >= 0.4.1`, the engine automatically detects if you are using V1 or V2 models and routes the execution perfectly.
50
 
51
  ```rust
52
  use gliner2_inference::{Gliner2Engine, ModelType, SchemaTask};
53
 
54
+ // Auto-downloads the V2 FP16 models from this HuggingFace repo
55
+ // and automatically switches to the high-performance IOBinding Engine!
56
  let engine = Gliner2Engine::from_pretrained(
57
  "SemplificaAI/gliner2-multi-v1-onnx",
58
+ Some("fp16_v2"),
59
  ModelType::HuggingFace
60
  )?;
61
 
 
71
 
72
  ## πŸ”§ Model Fixes
73
  - `count_lstm` has been successfully exported with dynamic sequence unrolling by replacing the training `CompileSafeGRU` with native `nn.GRU`, resolving Out-of-Bounds `Gather` ONNX errors for variable length texts.
74
+ - **(V2)** `Scorer` now uses a heavily optimized fused combination of `Reshape` + `MatMul` + `Transpose` instead of `Einsum`, ensuring compatibility with execution providers that don't support `Einsum` in FP16 (e.g. QNN, CoreML).