Instructions to use cimo001/urchade with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- GLiNER
How to use cimo001/urchade with GLiNER:
from gliner import GLiNER model = GLiNER.from_pretrained("cimo001/urchade") text = "Cristiano Ronaldo dos Santos Aveiro was born on 5 February 1985 in Funchal, Madeira, Portugal." labels = ["person", "date", "location"] entities = model.predict_entities(text, labels) for entity in entities: print(entity["text"], "=>", entity["label"]) - Notebooks
- Google Colab
- Kaggle
update
Browse files
README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: urchade
|
| 4 |
+
pipeline_tag: token-classification
|
| 5 |
+
library_name: onnx
|
| 6 |
+
language:
|
| 7 |
+
- multilingual
|
| 8 |
+
tags:
|
| 9 |
+
- ner
|
| 10 |
+
- gliner
|
| 11 |
+
- urchade
|
| 12 |
+
- onnx
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# ONNX - Urchade
|
| 16 |
+
|
| 17 |
+
| Model | FP32 | INT8 | Task |
|
| 18 |
+
| --- | --- | --- | --- |
|
| 19 |
+
| gliner_multi-v2.1 | model.onnx | model_quantized.onnx | named entity recognition |
|
| 20 |
+
|
| 21 |
+
## Usage
|
| 22 |
+
|
| 23 |
+
```
|
| 24 |
+
# onnxruntime-gpu for run it on GPU
|
| 25 |
+
pip install onnxruntime sentencepiece numpy protobuf
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
Every model folder has the same layout:
|
| 29 |
+
|
| 30 |
+
- `src/helper.py` = onnx session builder (provider selection, threads, memory options)
|
| 31 |
+
- `src/example.py` = full pipeline: word split, sentencepiece tokenization, span enumeration, inference, greedy non-overlap selection
|
| 32 |
+
- `onnx/` = the model file
|
| 33 |
+
|
| 34 |
+
Run the commands from the repository root.
|
| 35 |
+
|
| 36 |
+
## gliner_multi-v2.1
|
| 37 |
+
|
| 38 |
+
- [gliner_multi-v2.1/src/example.py](gliner_multi-v2.1/src/example.py)
|
| 39 |
+
|
| 40 |
+
```
|
| 41 |
+
python3 gliner_multi-v2.1/src/example.py
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
```
|
| 45 |
+
0.970778 | person | Linus Torvalds
|
| 46 |
+
0.603953 | organization | Linux
|
| 47 |
+
0.978727 | place | Helsinki
|
| 48 |
+
0.859634 | organization | Linux Foundation
|
| 49 |
+
0.944801 | person | 鐢颁腑澶儙
|
| 50 |
+
0.674417 | organization | 鏉变含澶у
|
| 51 |
+
0.953844 | place | Tokyo
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
Note:
|
| 55 |
+
- No transformers/tokenizers dependency: the tokenizer is `spm.model` loaded via proto with the patch<br>
|
| 56 |
+
`normalizer_spec.add_dummy_prefix = False` (required for the word-level alignment).
|
| 57 |
+
- Entity types are free text, passed in the input sequence:<br>
|
| 58 |
+
`[cls] [ent] type... [ent] type... [sep] word... [eos]`, with `[ent]` = 250103, `[sep]` = 250104.
|
| 59 |
+
- `words_mask` marks the first subword of each word with the word number (1-based), 0 elsewhere.
|
| 60 |
+
- Digits are tokenized one at a time (`\d|\D+`), CJK characters are split one word each.
|
| 61 |
+
- Spans are enumerated per word up to width 12, score = sigmoid(logit), greedy selection without overlap.
|
| 62 |
+
- Normalize input with NFKC for consistent multilingual scores.
|