Upload distilbert-NER ONNX model
Browse files- README.md +57 -0
- config.json +48 -0
- model.onnx +3 -0
- vocab.txt +0 -0
README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: onnx
|
| 3 |
+
tags:
|
| 4 |
+
- distilbert
|
| 5 |
+
- ner
|
| 6 |
+
- named-entity-recognition
|
| 7 |
+
- token-classification
|
| 8 |
+
- conll2003
|
| 9 |
+
- onnx
|
| 10 |
+
- inference4j
|
| 11 |
+
license: apache-2.0
|
| 12 |
+
pipeline_tag: token-classification
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# DistilBERT NER — ONNX
|
| 16 |
+
|
| 17 |
+
ONNX export of [dslim/distilbert-NER](https://huggingface.co/dslim/distilbert-NER), a DistilBERT model fine-tuned on CoNLL-2003 for Named Entity Recognition. Identifies persons, organizations, locations, and miscellaneous entities in text using IOB2 tagging.
|
| 18 |
+
|
| 19 |
+
Mirrored for use with [inference4j](https://github.com/inference4j/inference4j), an inference-only AI library for Java.
|
| 20 |
+
|
| 21 |
+
## Original Source
|
| 22 |
+
|
| 23 |
+
- **Repository:** [dslim (ONNX by onnx-community)](https://huggingface.co/dslim/distilbert-NER)
|
| 24 |
+
- **License:** apache-2.0
|
| 25 |
+
|
| 26 |
+
## Usage with inference4j
|
| 27 |
+
|
| 28 |
+
```java
|
| 29 |
+
try (BertNerRecognizer ner = BertNerRecognizer.builder()
|
| 30 |
+
.modelId("inference4j/distilbert-NER")
|
| 31 |
+
.build()) {
|
| 32 |
+
List<NamedEntity> entities = ner.recognize("John works at Google in London.");
|
| 33 |
+
for (NamedEntity e : entities) {
|
| 34 |
+
System.out.printf("%s (%s)%n", e.text(), e.label());
|
| 35 |
+
}
|
| 36 |
+
// John (PER)
|
| 37 |
+
// Google (ORG)
|
| 38 |
+
// London (LOC)
|
| 39 |
+
}
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
## Model Details
|
| 43 |
+
|
| 44 |
+
| Property | Value |
|
| 45 |
+
|----------|-------|
|
| 46 |
+
| Architecture | DistilBERT (6 layers, 768 hidden, 66M params) |
|
| 47 |
+
| Task | Named Entity Recognition (IOB2 tagging) |
|
| 48 |
+
| Labels | O, B-PER, I-PER, B-ORG, I-ORG, B-LOC, I-LOC, B-MISC, I-MISC |
|
| 49 |
+
| Training data | CoNLL-2003 |
|
| 50 |
+
| F1 score | 92.17 |
|
| 51 |
+
| Max sequence length | 512 |
|
| 52 |
+
| Tokenizer | WordPiece (cased) |
|
| 53 |
+
| Original framework | PyTorch (HuggingFace Transformers) |
|
| 54 |
+
|
| 55 |
+
## License
|
| 56 |
+
|
| 57 |
+
This model is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). Original model by [dslim](https://huggingface.co/dslim/distilbert-NER), ONNX export by [onnx-community](https://huggingface.co/onnx-community).
|
config.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_attn_implementation_autoset": true,
|
| 3 |
+
"_name_or_path": "dslim/distilbert-NER",
|
| 4 |
+
"activation": "gelu",
|
| 5 |
+
"architectures": [
|
| 6 |
+
"DistilBertForTokenClassification"
|
| 7 |
+
],
|
| 8 |
+
"attention_dropout": 0.1,
|
| 9 |
+
"dim": 768,
|
| 10 |
+
"dropout": 0.1,
|
| 11 |
+
"hidden_dim": 3072,
|
| 12 |
+
"id2label": {
|
| 13 |
+
"0": "O",
|
| 14 |
+
"1": "B-PER",
|
| 15 |
+
"2": "I-PER",
|
| 16 |
+
"3": "B-ORG",
|
| 17 |
+
"4": "I-ORG",
|
| 18 |
+
"5": "B-LOC",
|
| 19 |
+
"6": "I-LOC",
|
| 20 |
+
"7": "B-MISC",
|
| 21 |
+
"8": "I-MISC"
|
| 22 |
+
},
|
| 23 |
+
"initializer_range": 0.02,
|
| 24 |
+
"label2id": {
|
| 25 |
+
"B-LOC": 5,
|
| 26 |
+
"B-MISC": 7,
|
| 27 |
+
"B-ORG": 3,
|
| 28 |
+
"B-PER": 1,
|
| 29 |
+
"I-LOC": 6,
|
| 30 |
+
"I-MISC": 8,
|
| 31 |
+
"I-ORG": 4,
|
| 32 |
+
"I-PER": 2,
|
| 33 |
+
"O": 0
|
| 34 |
+
},
|
| 35 |
+
"max_position_embeddings": 512,
|
| 36 |
+
"model_type": "distilbert",
|
| 37 |
+
"n_heads": 12,
|
| 38 |
+
"n_layers": 6,
|
| 39 |
+
"output_past": true,
|
| 40 |
+
"pad_token_id": 0,
|
| 41 |
+
"qa_dropout": 0.1,
|
| 42 |
+
"seq_classif_dropout": 0.2,
|
| 43 |
+
"sinusoidal_pos_embds": false,
|
| 44 |
+
"tie_weights_": true,
|
| 45 |
+
"torch_dtype": "float32",
|
| 46 |
+
"transformers_version": "4.49.0",
|
| 47 |
+
"vocab_size": 28996
|
| 48 |
+
}
|
model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b5f77096d0d9f425d34a2e263f8a2dfb845cdc757dc00c7a1e69e9cbb93115d5
|
| 3 |
+
size 260924462
|
vocab.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|