commit files to HF hub
Browse files- README.md +25 -0
- config.json +23 -0
- inference.py +10 -0
- openvino_model.bin +3 -0
- openvino_model.xml +0 -0
- special_tokens_map.json +7 -0
- tokenizer.json +0 -0
- tokenizer_config.json +15 -0
- vocab.txt +0 -0
README.md
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
tags:
|
5 |
+
- openvino
|
6 |
+
---
|
7 |
+
|
8 |
+
# assemblyai/distilbert-base-uncased-sst2
|
9 |
+
|
10 |
+
This is the [assemblyai/distilbert-base-uncased-sst2](https://huggingface.co/assemblyai/distilbert-base-uncased-sst2) 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/assemblyai-distilbert-base-uncased-sst2-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,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "assemblyai/distilbert-base-uncased-sst2",
|
3 |
+
"activation": "gelu",
|
4 |
+
"architectures": [
|
5 |
+
"DistilBertForSequenceClassification"
|
6 |
+
],
|
7 |
+
"attention_dropout": 0.1,
|
8 |
+
"dim": 768,
|
9 |
+
"dropout": 0.1,
|
10 |
+
"hidden_dim": 3072,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"max_position_embeddings": 512,
|
13 |
+
"model_type": "distilbert",
|
14 |
+
"n_heads": 12,
|
15 |
+
"n_layers": 6,
|
16 |
+
"pad_token_id": 0,
|
17 |
+
"qa_dropout": 0.1,
|
18 |
+
"seq_classif_dropout": 0.2,
|
19 |
+
"sinusoidal_pos_embds": false,
|
20 |
+
"tie_weights_": true,
|
21 |
+
"transformers_version": "4.27.4",
|
22 |
+
"vocab_size": 30522
|
23 |
+
}
|
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/assemblyai-distilbert-base-uncased-sst2-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:65f206e2db7a62f29740d3ad5201420eaf110c4bf7c88205453314dd22e2907d
|
3 |
+
size 267824276
|
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": "/home/ubuntu/.cache/huggingface/hub/models--assemblyai--distilbert-base-uncased-sst2/snapshots/b22ecd1ae8fe1a941bf478fec027bdc996ba190f/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
|
|