helenai commited on
Commit
0bdaddd
1 Parent(s): 00b7902

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
+ # echarlaix/bert-base-uncased-sst2-acc91.1-d37-hybrid
9
+
10
+ This is the [echarlaix/bert-base-uncased-sst2-acc91.1-d37-hybrid](https://huggingface.co/echarlaix/bert-base-uncased-sst2-acc91.1-d37-hybrid) 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 OVModelForSequenceClassification
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/echarlaix-bert-base-uncased-sst2-acc91.1-d37-hybrid-ov"
19
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
20
+ model = OVModelForSequenceClassification.from_pretrained(model_id)
21
+ pipe = pipeline("text-classification", model=model, tokenizer=tokenizer)
22
+ result = pipe("I like you. I love you")
23
+ print(result)
24
+ ```
25
+
config.json ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "echarlaix/bert-base-uncased-sst2-acc91.1-d37-hybrid",
3
+ "architectures": [
4
+ "BertForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "classifier_dropout": null,
8
+ "finetuning_task": "sst2",
9
+ "gradient_checkpointing": false,
10
+ "heads_count": 56,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.1,
13
+ "hidden_size": 768,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 3072,
16
+ "layer_norm_eps": 1e-12,
17
+ "max_position_embeddings": 512,
18
+ "model_type": "bert",
19
+ "num_attention_heads": 12,
20
+ "num_hidden_layers": 12,
21
+ "pad_token_id": 0,
22
+ "position_embedding_type": "absolute",
23
+ "pruned_heads": {
24
+ "0": [
25
+ 0,
26
+ 4,
27
+ 6,
28
+ 7,
29
+ 8,
30
+ 9,
31
+ 11
32
+ ],
33
+ "1": [
34
+ 0,
35
+ 2,
36
+ 3,
37
+ 5,
38
+ 6,
39
+ 7,
40
+ 8,
41
+ 9
42
+ ],
43
+ "2": [
44
+ 2,
45
+ 3,
46
+ 4,
47
+ 5,
48
+ 6,
49
+ 7,
50
+ 8,
51
+ 10,
52
+ 11
53
+ ],
54
+ "3": [
55
+ 0,
56
+ 1,
57
+ 2,
58
+ 3,
59
+ 4,
60
+ 6,
61
+ 7,
62
+ 8,
63
+ 11
64
+ ],
65
+ "4": [
66
+ 1,
67
+ 2,
68
+ 3,
69
+ 4,
70
+ 8
71
+ ],
72
+ "5": [
73
+ 1,
74
+ 2,
75
+ 5,
76
+ 11
77
+ ],
78
+ "6": [
79
+ 1,
80
+ 3,
81
+ 7,
82
+ 9,
83
+ 10,
84
+ 11
85
+ ],
86
+ "7": [
87
+ 2,
88
+ 4,
89
+ 6,
90
+ 7,
91
+ 11
92
+ ],
93
+ "8": [
94
+ 0,
95
+ 2,
96
+ 3,
97
+ 4,
98
+ 5,
99
+ 6
100
+ ],
101
+ "9": [
102
+ 0,
103
+ 1,
104
+ 3,
105
+ 4,
106
+ 6,
107
+ 8,
108
+ 9,
109
+ 11
110
+ ],
111
+ "10": [
112
+ 0,
113
+ 1,
114
+ 2,
115
+ 3,
116
+ 5,
117
+ 6,
118
+ 7,
119
+ 8,
120
+ 9,
121
+ 10
122
+ ],
123
+ "11": [
124
+ 1,
125
+ 2,
126
+ 3,
127
+ 4,
128
+ 5,
129
+ 6,
130
+ 7,
131
+ 8,
132
+ 9,
133
+ 10,
134
+ 11
135
+ ]
136
+ },
137
+ "transformers_version": "4.27.4",
138
+ "type_vocab_size": 2,
139
+ "use_cache": true,
140
+ "vocab_size": 30522
141
+ }
inference.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ from optimum.intel.openvino import OVModelForSequenceClassification
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/echarlaix-bert-base-uncased-sst2-acc91.1-d37-hybrid-ov"
6
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
7
+ model = OVModelForSequenceClassification.from_pretrained(model_id)
8
+ pipe = pipeline("text-classification", model=model, tokenizer=tokenizer)
9
+ result = pipe("I like you. I love you")
10
+ print(result)
openvino_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f3037826b4d308719123e419f27d0c7c025d31e0433c3a273be14bebd3da02fc
3
+ size 368272116
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": true,
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": null,
11
+ "strip_accents": null,
12
+ "tokenize_chinese_chars": true,
13
+ "tokenizer_class": "BertTokenizer",
14
+ "unk_token": "[UNK]"
15
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff