helenai commited on
Commit
3faa120
1 Parent(s): 429dc93

commit files to HF hub

Browse files
README.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - openvino
6
+ ---
7
+
8
+ # elastic/distilbert-base-cased-finetuned-conll03-english
9
+
10
+ This is the [elastic/distilbert-base-cased-finetuned-conll03-english](https://huggingface.co/elastic/distilbert-base-cased-finetuned-conll03-english) model converted to [OpenVINO](https://openvino.ai), for accellerated inference.
11
+
12
+ An example of how to do inference on this model:
13
+ ```python
14
+ from optimum.intel.openvino import OVModelForTokenClassification
15
+ from transformers import AutoTokenizer, pipeline
16
+
17
+ # model_id should be set to either a local directory or a model available on the HuggingFace hub.
18
+ model_id = "helenai/elastic-distilbert-base-cased-finetuned-conll03-english-ov"
19
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
20
+ model = OVModelForTokenClassification.from_pretrained(model_id)
21
+ pipe = pipeline("token-classification", model=model, tokenizer=tokenizer)
22
+ result = pipe("My name is Wolfgang and I live in Berlin")
23
+ print(result)
24
+ ```
25
+
config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "elastic/distilbert-base-cased-finetuned-conll03-english",
3
+ "activation": "gelu",
4
+ "architectures": [
5
+ "DistilBertForTokenClassification"
6
+ ],
7
+ "attention_dropout": 0.1,
8
+ "dim": 768,
9
+ "dropout": 0.1,
10
+ "finetuning_task": "ner",
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
+ "transformers_version": "4.27.4",
46
+ "vocab_size": 28996
47
+ }
inference.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ from optimum.intel.openvino import OVModelForTokenClassification
2
+ from transformers import AutoTokenizer, pipeline
3
+
4
+ # model_id should be set to either a local directory or a model available on the HuggingFace hub.
5
+ model_id = "helenai/elastic-distilbert-base-cased-finetuned-conll03-english-ov"
6
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
7
+ model = OVModelForTokenClassification.from_pretrained(model_id)
8
+ pipe = pipeline("token-classification", model=model, tokenizer=tokenizer)
9
+ result = pipe("My name is Wolfgang and I live in Berlin")
10
+ print(result)
openvino_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:65730487117591d08348e1dad2eec3c4037fd3e9795985132da5d13b77c14c2f
3
+ size 260795568
openvino_model.xml ADDED
The diff for this file is too large to render. See raw diff
 
special_tokens_map.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "do_basic_tokenize": true,
4
+ "do_lower_case": false,
5
+ "mask_token": "[MASK]",
6
+ "model_max_length": 512,
7
+ "never_split": null,
8
+ "pad_token": "[PAD]",
9
+ "sep_token": "[SEP]",
10
+ "special_tokens_map_file": "/home/ubuntu/.cache/huggingface/hub/models--elastic--distilbert-base-cased-finetuned-conll03-english/snapshots/ac68e05b23b29ba32563ab18b633bb1423d859f8/special_tokens_map.json",
11
+ "strip_accents": null,
12
+ "tokenize_chinese_chars": true,
13
+ "tokenizer_class": "DistilBertTokenizer",
14
+ "unk_token": "[UNK]"
15
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff