Upload folder using huggingface_hub
Browse files- README.md +5 -54
- config.json +3 -2
- onnx/model.onnx +3 -0
- onnx/model_bnb4.onnx +3 -0
- onnx/model_fp16.onnx +3 -0
- onnx/model_int8.onnx +3 -0
- onnx/model_q4.onnx +3 -0
- onnx/model_q4f16.onnx +3 -0
- onnx/model_quantized.onnx +3 -0
- onnx/model_uint8.onnx +3 -0
- quantize_config.json +18 -0
- special_tokens_map.json +35 -5
- tokenizer_config.json +1 -0
README.md
CHANGED
@@ -1,58 +1,9 @@
|
|
1 |
---
|
2 |
-
|
3 |
-
|
4 |
-
- cnmoro/
|
5 |
-
tags:
|
6 |
-
- classification
|
7 |
-
- questioning
|
8 |
-
- directed
|
9 |
-
- generic
|
10 |
-
language:
|
11 |
-
- en
|
12 |
-
- pt
|
13 |
-
library_name: transformers
|
14 |
-
pipeline_tag: text-classification
|
15 |
-
widget:
|
16 |
-
- text: "What is the summary of the text?"
|
17 |
---
|
18 |
|
19 |
-
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
The goal is to classify questions into "Directed" or "Generic".
|
24 |
-
|
25 |
-
If a question is not directed, we would change the actions we perform on a RAG pipeline (if it is generic, semantic search wouldn't be useful directly; e.g. asking for a summary).
|
26 |
-
|
27 |
-
(Class 0 is Generic; Class 1 is Directed)
|
28 |
-
|
29 |
-
The accuracy on the training dataset is around 87.5%
|
30 |
-
|
31 |
-
```python
|
32 |
-
from transformers import BertForSequenceClassification, BertTokenizerFast
|
33 |
-
import torch
|
34 |
-
|
35 |
-
# Load the model and tokenizer
|
36 |
-
model = BertForSequenceClassification.from_pretrained("cnmoro/bert-tiny-question-classifier")
|
37 |
-
tokenizer = BertTokenizerFast.from_pretrained("cnmoro/bert-tiny-question-classifier")
|
38 |
-
|
39 |
-
def is_question_generic(question):
|
40 |
-
# Tokenize the sentence and convert to PyTorch tensors
|
41 |
-
inputs = tokenizer(
|
42 |
-
question.lower(),
|
43 |
-
truncation=True,
|
44 |
-
padding=True,
|
45 |
-
return_tensors="pt",
|
46 |
-
max_length=512
|
47 |
-
)
|
48 |
-
|
49 |
-
# Get the model's predictions
|
50 |
-
with torch.no_grad():
|
51 |
-
outputs = model(**inputs)
|
52 |
-
|
53 |
-
# Extract the prediction
|
54 |
-
predictions = outputs.logits
|
55 |
-
predicted_class = torch.argmax(predictions).item()
|
56 |
-
|
57 |
-
return int(predicted_class) == 0
|
58 |
-
```
|
|
|
1 |
---
|
2 |
+
library_name: transformers.js
|
3 |
+
base_model:
|
4 |
+
- cnmoro/bert-tiny-question-classifier
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
---
|
6 |
|
7 |
+
# bert-tiny-question-classifier (ONNX)
|
8 |
|
9 |
+
This is an ONNX version of [cnmoro/bert-tiny-question-classifier](https://huggingface.co/cnmoro/bert-tiny-question-classifier). It was automatically converted and uploaded using [this space](https://huggingface.co/spaces/onnx-community/convert-to-onnx).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config.json
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
{
|
2 |
-
"
|
|
|
3 |
"architectures": [
|
4 |
"BertForSequenceClassification"
|
5 |
],
|
@@ -19,7 +20,7 @@
|
|
19 |
"position_embedding_type": "absolute",
|
20 |
"problem_type": "single_label_classification",
|
21 |
"torch_dtype": "float32",
|
22 |
-
"transformers_version": "4.
|
23 |
"type_vocab_size": 2,
|
24 |
"use_cache": true,
|
25 |
"vocab_size": 30522
|
|
|
1 |
{
|
2 |
+
"_attn_implementation_autoset": true,
|
3 |
+
"_name_or_path": "cnmoro/bert-tiny-question-classifier",
|
4 |
"architectures": [
|
5 |
"BertForSequenceClassification"
|
6 |
],
|
|
|
20 |
"position_embedding_type": "absolute",
|
21 |
"problem_type": "single_label_classification",
|
22 |
"torch_dtype": "float32",
|
23 |
+
"transformers_version": "4.49.0",
|
24 |
"type_vocab_size": 2,
|
25 |
"use_cache": true,
|
26 |
"vocab_size": 30522
|
onnx/model.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:08a5902e48e37239982aa9f2e9d20927c0a6e579188b0f909565a14a605f1f37
|
3 |
+
size 17607002
|
onnx/model_bnb4.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:382fca90b333ad3663449e580b1d08accccac898b441ac854ffc95891609e564
|
3 |
+
size 16257153
|
onnx/model_fp16.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7d00d2ce77e5636976849bd8a258796c6622534371f96189f1e46f48c885916d
|
3 |
+
size 8835044
|
onnx/model_int8.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:659c83b11f04eb93079315c8ca9115aa77cb9e2159dc474c8aded4bd36589a34
|
3 |
+
size 4490601
|
onnx/model_q4.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:aafcb51f3878dfe778ea76060d43a939048ef7b6824baa6cefd07e9ed7650e21
|
3 |
+
size 16281641
|
onnx/model_q4f16.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8a64ffabb9638808ec68f9ab72f5a29e5a6dc9e708d369f527e7147f6d9225ac
|
3 |
+
size 8271539
|
onnx/model_quantized.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:659c83b11f04eb93079315c8ca9115aa77cb9e2159dc474c8aded4bd36589a34
|
3 |
+
size 4490601
|
onnx/model_uint8.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fe3821d902f3f367f0a8145da71be977e2466972d4d3e81400059b4ba0d45cb0
|
3 |
+
size 4490601
|
quantize_config.json
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"modes": [
|
3 |
+
"fp16",
|
4 |
+
"q8",
|
5 |
+
"int8",
|
6 |
+
"uint8",
|
7 |
+
"q4",
|
8 |
+
"q4f16",
|
9 |
+
"bnb4"
|
10 |
+
],
|
11 |
+
"per_channel": true,
|
12 |
+
"reduce_range": true,
|
13 |
+
"block_size": null,
|
14 |
+
"is_symmetric": true,
|
15 |
+
"accuracy_level": null,
|
16 |
+
"quant_type": 1,
|
17 |
+
"op_block_list": null
|
18 |
+
}
|
special_tokens_map.json
CHANGED
@@ -1,7 +1,37 @@
|
|
1 |
{
|
2 |
-
"cls_token":
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
}
|
|
|
1 |
{
|
2 |
+
"cls_token": {
|
3 |
+
"content": "[CLS]",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": false,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"mask_token": {
|
10 |
+
"content": "[MASK]",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": false,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": {
|
17 |
+
"content": "[PAD]",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": false,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
},
|
23 |
+
"sep_token": {
|
24 |
+
"content": "[SEP]",
|
25 |
+
"lstrip": false,
|
26 |
+
"normalized": false,
|
27 |
+
"rstrip": false,
|
28 |
+
"single_word": false
|
29 |
+
},
|
30 |
+
"unk_token": {
|
31 |
+
"content": "[UNK]",
|
32 |
+
"lstrip": false,
|
33 |
+
"normalized": false,
|
34 |
+
"rstrip": false,
|
35 |
+
"single_word": false
|
36 |
+
}
|
37 |
}
|
tokenizer_config.json
CHANGED
@@ -45,6 +45,7 @@
|
|
45 |
"cls_token": "[CLS]",
|
46 |
"do_basic_tokenize": true,
|
47 |
"do_lower_case": true,
|
|
|
48 |
"mask_token": "[MASK]",
|
49 |
"model_max_length": 1000000000000000019884624838656,
|
50 |
"never_split": null,
|
|
|
45 |
"cls_token": "[CLS]",
|
46 |
"do_basic_tokenize": true,
|
47 |
"do_lower_case": true,
|
48 |
+
"extra_special_tokens": {},
|
49 |
"mask_token": "[MASK]",
|
50 |
"model_max_length": 1000000000000000019884624838656,
|
51 |
"never_split": null,
|