Upload folder using huggingface_hub
Browse files- README.md +26 -61
- config.json +1 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +7 -0
- tokenizer.json +0 -0
- tokenizer_config.json +55 -0
- vocab.txt +0 -0
README.md
CHANGED
@@ -1,72 +1,37 @@
|
|
1 |
---
|
2 |
-
|
3 |
tags:
|
4 |
-
-
|
5 |
-
|
6 |
-
-
|
7 |
-
-
|
8 |
-
- precision
|
9 |
-
- recall
|
10 |
-
model-index:
|
11 |
-
- name: bert-clf-biencoder-cross_entropy
|
12 |
-
results: []
|
13 |
---
|
14 |
|
15 |
-
|
16 |
-
should probably proofread and complete it, then remove this comment. -->
|
17 |
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
-
|
23 |
-
-
|
24 |
-
- F1: 0.6648
|
25 |
-
- Precision: 0.6687
|
26 |
-
- Recall: 0.6634
|
27 |
|
28 |
-
##
|
29 |
|
30 |
-
|
|
|
|
|
31 |
|
32 |
-
|
|
|
33 |
|
34 |
-
|
|
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
The following hyperparameters were used during training:
|
45 |
-
- learning_rate: 2e-05
|
46 |
-
- train_batch_size: 32
|
47 |
-
- eval_batch_size: 32
|
48 |
-
- seed: 42
|
49 |
-
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
50 |
-
- lr_scheduler_type: linear
|
51 |
-
- lr_scheduler_warmup_steps: 100
|
52 |
-
- num_epochs: 7
|
53 |
-
|
54 |
-
### Training results
|
55 |
-
|
56 |
-
| Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 | Precision | Recall |
|
57 |
-
|:-------------:|:-----:|:----:|:---------------:|:--------:|:------:|:---------:|:------:|
|
58 |
-
| 1.1883 | 1.0 | 78 | 1.0551 | 0.6019 | 0.5890 | 0.5964 | 0.6019 |
|
59 |
-
| 0.859 | 2.0 | 156 | 0.8377 | 0.6311 | 0.6231 | 0.6472 | 0.6311 |
|
60 |
-
| 0.6539 | 3.0 | 234 | 0.7989 | 0.6634 | 0.6651 | 0.6677 | 0.6634 |
|
61 |
-
| 0.5242 | 4.0 | 312 | 0.8181 | 0.6731 | 0.6717 | 0.6823 | 0.6731 |
|
62 |
-
| 0.3728 | 5.0 | 390 | 0.8442 | 0.6861 | 0.6855 | 0.6889 | 0.6861 |
|
63 |
-
| 0.2566 | 6.0 | 468 | 0.9040 | 0.6764 | 0.6769 | 0.6779 | 0.6764 |
|
64 |
-
| 0.1959 | 7.0 | 546 | 0.9480 | 0.6634 | 0.6648 | 0.6687 | 0.6634 |
|
65 |
-
|
66 |
-
|
67 |
-
### Framework versions
|
68 |
-
|
69 |
-
- Transformers 4.45.1
|
70 |
-
- Pytorch 2.4.0
|
71 |
-
- Datasets 3.0.1
|
72 |
-
- Tokenizers 0.20.0
|
|
|
1 |
---
|
2 |
+
language: en
|
3 |
tags:
|
4 |
+
- bert
|
5 |
+
- classification
|
6 |
+
- pytorch
|
7 |
+
pipeline_tag: text-classification
|
|
|
|
|
|
|
|
|
|
|
8 |
---
|
9 |
|
10 |
+
# BiEncoder Classification Model
|
|
|
11 |
|
12 |
+
This model is a BiEncoder architecture based on BERT for text pair classification.
|
13 |
|
14 |
+
## Model Details
|
15 |
+
- Base Model: bert-base-uncased
|
16 |
+
- Architecture: BiEncoder with BERT base
|
17 |
+
- Number of classes: 4
|
|
|
|
|
|
|
18 |
|
19 |
+
## Usage
|
20 |
|
21 |
+
```python
|
22 |
+
from transformers import AutoTokenizer
|
23 |
+
import torch
|
24 |
|
25 |
+
# Load tokenizer
|
26 |
+
tokenizer = AutoTokenizer.from_pretrained("minoosh/bert-clf-biencoder-cross_entropy")
|
27 |
|
28 |
+
# Load model weights
|
29 |
+
state_dict = torch.load("pytorch_model.bin")
|
30 |
|
31 |
+
# Initialize model (you'll need the BiEncoderModel class)
|
32 |
+
model = BiEncoderModel(
|
33 |
+
base_model=AutoModel.from_pretrained("bert-base-uncased"),
|
34 |
+
num_classes=4
|
35 |
+
)
|
36 |
+
model.load_state_dict(state_dict)
|
37 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"return_dict": true, "output_hidden_states": false, "output_attentions": false, "torchscript": false, "torch_dtype": null, "use_bfloat16": false, "tf_legacy_loss": false, "pruned_heads": {}, "tie_word_embeddings": true, "chunk_size_feed_forward": 0, "is_encoder_decoder": false, "is_decoder": false, "cross_attention_hidden_size": null, "add_cross_attention": false, "tie_encoder_decoder": false, "max_length": 20, "min_length": 0, "do_sample": false, "early_stopping": false, "num_beams": 1, "num_beam_groups": 1, "diversity_penalty": 0.0, "temperature": 1.0, "top_k": 50, "top_p": 1.0, "typical_p": 1.0, "repetition_penalty": 1.0, "length_penalty": 1.0, "no_repeat_ngram_size": 0, "encoder_no_repeat_ngram_size": 0, "bad_words_ids": null, "num_return_sequences": 1, "output_scores": false, "return_dict_in_generate": false, "forced_bos_token_id": null, "forced_eos_token_id": null, "remove_invalid_values": false, "exponential_decay_length_penalty": null, "suppress_tokens": null, "begin_suppress_tokens": null, "architectures": ["BertModel"], "finetuning_task": null, "id2label": {"0": "LABEL_0", "1": "LABEL_1"}, "label2id": {"LABEL_0": 0, "LABEL_1": 1}, "tokenizer_class": null, "prefix": null, "bos_token_id": null, "pad_token_id": 0, "eos_token_id": null, "sep_token_id": null, "decoder_start_token_id": null, "task_specific_params": null, "problem_type": null, "_name_or_path": "bert-base-uncased", "transformers_version": "4.45.1", "gradient_checkpointing": false, "model_type": "bert", "vocab_size": 30522, "hidden_size": 768, "num_hidden_layers": 12, "num_attention_heads": 12, "hidden_act": "gelu", "intermediate_size": 3072, "hidden_dropout_prob": 0.1, "attention_probs_dropout_prob": 0.1, "max_position_embeddings": 512, "type_vocab_size": 2, "initializer_range": 0.02, "layer_norm_eps": 1e-12, "position_embedding_type": "absolute", "use_cache": true, "classifier_dropout": null}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:095580febcab6e4e715a3384e985951a58280c985a8949451129b8675eae2c36
|
3 |
+
size 438038894
|
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,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"added_tokens_decoder": {
|
3 |
+
"0": {
|
4 |
+
"content": "[PAD]",
|
5 |
+
"lstrip": false,
|
6 |
+
"normalized": false,
|
7 |
+
"rstrip": false,
|
8 |
+
"single_word": false,
|
9 |
+
"special": true
|
10 |
+
},
|
11 |
+
"100": {
|
12 |
+
"content": "[UNK]",
|
13 |
+
"lstrip": false,
|
14 |
+
"normalized": false,
|
15 |
+
"rstrip": false,
|
16 |
+
"single_word": false,
|
17 |
+
"special": true
|
18 |
+
},
|
19 |
+
"101": {
|
20 |
+
"content": "[CLS]",
|
21 |
+
"lstrip": false,
|
22 |
+
"normalized": false,
|
23 |
+
"rstrip": false,
|
24 |
+
"single_word": false,
|
25 |
+
"special": true
|
26 |
+
},
|
27 |
+
"102": {
|
28 |
+
"content": "[SEP]",
|
29 |
+
"lstrip": false,
|
30 |
+
"normalized": false,
|
31 |
+
"rstrip": false,
|
32 |
+
"single_word": false,
|
33 |
+
"special": true
|
34 |
+
},
|
35 |
+
"103": {
|
36 |
+
"content": "[MASK]",
|
37 |
+
"lstrip": false,
|
38 |
+
"normalized": false,
|
39 |
+
"rstrip": false,
|
40 |
+
"single_word": false,
|
41 |
+
"special": true
|
42 |
+
}
|
43 |
+
},
|
44 |
+
"clean_up_tokenization_spaces": false,
|
45 |
+
"cls_token": "[CLS]",
|
46 |
+
"do_lower_case": true,
|
47 |
+
"mask_token": "[MASK]",
|
48 |
+
"model_max_length": 512,
|
49 |
+
"pad_token": "[PAD]",
|
50 |
+
"sep_token": "[SEP]",
|
51 |
+
"strip_accents": null,
|
52 |
+
"tokenize_chinese_chars": true,
|
53 |
+
"tokenizer_class": "BertTokenizer",
|
54 |
+
"unk_token": "[UNK]"
|
55 |
+
}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|