TomatenMarc
commited on
Commit
•
d28be65
1
Parent(s):
5ef0df3
Initial commit
Browse files- README.md +179 -0
- added_tokens.json +3 -0
- bpe.codes +0 -0
- config.json +42 -0
- model_args.json +1 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +9 -0
- tokenizer_config.json +14 -0
- training_args.bin +3 -0
- vocab.txt +0 -0
README.md
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-nc-4.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
metrics:
|
6 |
+
- f1
|
7 |
+
pipeline_tag: text-classification
|
8 |
+
widget:
|
9 |
+
- text: "Men shouldn’t be making laws about women’s bodies #abortion #Texas"
|
10 |
+
example_title: "Statement"
|
11 |
+
- text: "’Bitter truth’: EU chief pours cold water on idea of Brits keeping EU citizenship after #Brexit HTTPURL via @USER"
|
12 |
+
example_title: "Notification"
|
13 |
+
- text: "Opinion: As the draconian (and then some) abortion law takes effect in #Texas, this is not an idle question for millions of Americans. A slippery slope towards more like-minded Republican state legislatures to try to follow suit. #abortion #F24 HTTPURL"
|
14 |
+
example_title: "Reason"
|
15 |
+
- text: "@USER Blah blah blah blah blah blah"
|
16 |
+
example_title: "None"
|
17 |
+
- text: "republican men and karens make me sick"
|
18 |
+
example_title: "Unlabeled 1"
|
19 |
+
- text: "No empire lives forever! Historical fact! GodWins! 🙏💪🇺🇲"
|
20 |
+
example_title: "Unlabeled 2"
|
21 |
+
- text: "Further author information regarding registration and visa support letters will be sent to the authors soon. #CIKM2023"
|
22 |
+
example_title: "Unlabeled 3"
|
23 |
+
- text: "Ummmmmm"
|
24 |
+
example_title: "Unlabeled 4"
|
25 |
+
- text: "whoever says that The Last Jedi is a good movie is lying or trolling everyone"
|
26 |
+
example_title: "Unlabeled 5"
|
27 |
+
---
|
28 |
+
|
29 |
+
# TACO -- Twitter Arguments from COnversations
|
30 |
+
|
31 |
+
Introducing TACO, a baseline classification model built upon `AutoModelForSequenceClassification`, designed to identify tweets belonging to four distinct
|
32 |
+
classes: Reason, Statement, Notification, and None. Tailored specifically for argument mining on Twitter, this baseline model is an evolution of the
|
33 |
+
[BERTweet-base](https://huggingface.co/vinai/bertweet-base) architecture, which was originally pre-trained on Twitter data.
|
34 |
+
Through fine-tuning with the [TACO dataset](https://doi.org/10.5281/zenodo.8030026), the baseline model acquires its name and excels in the
|
35 |
+
extraction of *Twitter Arguments from COnversations*.
|
36 |
+
|
37 |
+
## Class Semantics
|
38 |
+
|
39 |
+
The TACO framework revolves around the two key elements of an argument, as defined by the [Cambridge Dictionary](https://dictionary.cambridge.org).
|
40 |
+
It encodes *inference* as *a guess that you make or an opinion that you form based on the information that you have*, and it also leverages the
|
41 |
+
definition of *information* as *facts or details about a person, company, product, etc.*.
|
42 |
+
|
43 |
+
Taken together, the following classes of tweets can be identified by TACO:
|
44 |
+
|
45 |
+
* *Statement*, which refers to unique cases where only the *inference* is presented as *something that someone says or writes officially, or an action
|
46 |
+
done to express an opinion* (see ex. 1).
|
47 |
+
* *Reason*, which represents a full argument where the *inference* is based on direct *information* mentioned in the tweet, such as a source-reference
|
48 |
+
or quotation, and thus reveals the author’s motivation *to try to understand and to make judgments based on practical facts* (see ex. 3).
|
49 |
+
* *Notification*, which refers to a tweet that limits itself to providing *information*, such as media channels promoting their latest articles
|
50 |
+
(see ex. 2).
|
51 |
+
* *None*, a tweet that provides neither *inference* nor *information* (see ex. 4).
|
52 |
+
|
53 |
+
|
54 |
+
In its entirety, TACO can classify the following hierarchy for tweets:
|
55 |
+
|
56 |
+
![image](https://www.researchgate.net/profile/Marc-Feger/publication/371595900/figure/fig1/AS:11431281168142295@1686846469455/Hierarchy-of-arguments-with-constituting-elements_W640.jpg)
|
57 |
+
|
58 |
+
## Usage
|
59 |
+
|
60 |
+
Using this model becomes easy when you have `transformers` installed:
|
61 |
+
|
62 |
+
```python
|
63 |
+
pip install - U transformers
|
64 |
+
```
|
65 |
+
|
66 |
+
Then you can use the model to generate tweet classifications like this:
|
67 |
+
|
68 |
+
```python
|
69 |
+
from transformers import pipeline
|
70 |
+
|
71 |
+
pipe = pipeline("text-classification", model="TomatenMarc/TACO")
|
72 |
+
prediction = pipe("Huggingface is awesome")
|
73 |
+
|
74 |
+
print(prediction)
|
75 |
+
```
|
76 |
+
|
77 |
+
<a href="https://github.com/TomatenMarc/TACO/blob/main/notebooks/classifier_cv.ipynb">
|
78 |
+
<blockquote style="border-left: 5px solid grey; background-color: #f0f5ff; padding: 10px;">
|
79 |
+
Notice: The tweets need to undergo preprocessing before classification.
|
80 |
+
</blockquote>
|
81 |
+
</a>
|
82 |
+
|
83 |
+
## Training
|
84 |
+
|
85 |
+
The final model underwent training using the entire shuffled ground truth dataset known as TACO, encompassing a total of 1734 tweets.
|
86 |
+
This dataset showcases the distribution of topics as: #abortion (25.9%), #brexit (29.0%), #got (11.0%), #lotrrop (12.1%), #squidgame (12.7%), and
|
87 |
+
#twittertakeover (9.3%). For training, we utilized [SimpleTransformers](https://simpletransformers.ai).
|
88 |
+
|
89 |
+
Additionally, the category and class distribution of the dataset TACO is as follows:
|
90 |
+
|
91 |
+
| Argument | No-Argument |
|
92 |
+
|--------------|------------------|
|
93 |
+
| 865 (49.88%) | 869 (50.12%) |
|
94 |
+
|
95 |
+
| Reason | Statement | Notification | None |
|
96 |
+
|--------------|--------------|--------------|--------------|
|
97 |
+
| 581 (33.50%) | 284 (16.38%) | 500 (28.84%) | 369 (21.28%) |
|
98 |
+
|
99 |
+
<p>
|
100 |
+
<blockquote style="border-left: 5px solid grey; background-color: #f0f5ff; padding: 10px;">
|
101 |
+
Notice: Our training involved TACO to forecast class predictions, where the categories (Argument/No-Argument) represent class aggregations
|
102 |
+
based on the inference component.
|
103 |
+
</blockquote>
|
104 |
+
<p>
|
105 |
+
|
106 |
+
### Dataloader
|
107 |
+
|
108 |
+
```
|
109 |
+
"data_loader": {
|
110 |
+
"type": "torch.utils.data.dataloader.DataLoader",
|
111 |
+
"args": {
|
112 |
+
"batch_size": 8,
|
113 |
+
"sampler": "torch.utils.data.sampler.RandomSampler"
|
114 |
+
}
|
115 |
+
}
|
116 |
+
```
|
117 |
+
|
118 |
+
Parameters of the fit()-Method:
|
119 |
+
|
120 |
+
```
|
121 |
+
{
|
122 |
+
"epochs": 5,
|
123 |
+
"max_grad_norm": 1,
|
124 |
+
"optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
|
125 |
+
"optimizer_params": {
|
126 |
+
"lr": 4e-05
|
127 |
+
},
|
128 |
+
"scheduler": "WarmupLinear",
|
129 |
+
"warmup_steps": 66,
|
130 |
+
"weight_decay": 0.06
|
131 |
+
}
|
132 |
+
```
|
133 |
+
|
134 |
+
## Evaluation
|
135 |
+
|
136 |
+
We utilized a stratified 10-fold cross-validation approach to present TACO's performance. In doing so, we employed the identical data and parameters
|
137 |
+
as outlined in the *Training* section. This involved training on k-1 splits and utilizing the kth split for making predictions.
|
138 |
+
|
139 |
+
In total, the TACO classifier performs as follows:
|
140 |
+
|
141 |
+
### Classification
|
142 |
+
|
143 |
+
| | Precision | Recall | F1-Score | Support |
|
144 |
+
|-------------|-----------|---------|----------|---------|
|
145 |
+
| Reason | 73.69% | 75.22% | 74.45% | 581 |
|
146 |
+
| Statement | 54.37% | 59.15% | 56.66% | 284 |
|
147 |
+
| Notification| 79.02% | 77.60% | 78.30% | 500 |
|
148 |
+
| None | 83.87% | 77.51% | 80.56% | 369 |
|
149 |
+
|-------------|-----------|---------|----------|---------|
|
150 |
+
| Accuracy | | | 73.76% | 1734 |
|
151 |
+
| Macro Avg | 72.74% | 72.37% | 72.49% | 1734 |
|
152 |
+
| Weighted Avg| 74.23% | 73.76% | 73.95% | 1734 |
|
153 |
+
|
154 |
+
### Categorization
|
155 |
+
|
156 |
+
| | Precision | Recall | F1-Score | Support |
|
157 |
+
|-------------|-----------|---------|----------|---------|
|
158 |
+
| No-Argument | 86.66% | 82.97% | 84.77% | 869 |
|
159 |
+
| Argument | 83.59% | 87.17% | 85.34% | 865 |
|
160 |
+
|-------------|-----------|---------|----------|---------|
|
161 |
+
| Accuracy | | | 85.06% | 1734 |
|
162 |
+
| Macro Avg | 85.13% | 85.07% | 85.06% | 1734 |
|
163 |
+
| Weighted Avg| 85.13% | 85.06% | 85.06% | 1734 |
|
164 |
+
|
165 |
+
# Environmental Impact
|
166 |
+
|
167 |
+
- **Hardware Type:** A100 PCIe 40GB
|
168 |
+
- **Hours used:** 10 min
|
169 |
+
- **Cloud Provider:** [Google Cloud Platform](https://colab.research.google.com)
|
170 |
+
- **Compute Region:** [asia-southeast1](https://cloud.google.com/compute/docs/gpus/gpu-regions-zones?hl=en) (Singapore)
|
171 |
+
- **Carbon Emitted:** 0.02kg CO2
|
172 |
+
|
173 |
+
## Licensing
|
174 |
+
|
175 |
+
[TACO](https://huggingface.co/TomatenMarc/TACO) © 2023 by [Marc Feger](mailto:marc.feger@uni-duesseldorf.de) is licensed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/?ref=chooser-v1)
|
176 |
+
|
177 |
+
## Contact
|
178 |
+
|
179 |
+
If you have any questions, please feel free to reach out to [marc.feger@uni-duesseldorf.de](mailto:marc.feger@uni-duesseldorf.de).
|
added_tokens.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"<mask>": 64000
|
3 |
+
}
|
bpe.codes
ADDED
The diff for this file is too large to render.
See raw diff
|
|
config.json
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "./model/TACO",
|
3 |
+
"architectures": [
|
4 |
+
"RobertaForSequenceClassification"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"bos_token_id": 0,
|
8 |
+
"classifier_dropout": null,
|
9 |
+
"eos_token_id": 2,
|
10 |
+
"gradient_checkpointing": false,
|
11 |
+
"hidden_act": "gelu",
|
12 |
+
"hidden_dropout_prob": 0.1,
|
13 |
+
"hidden_size": 768,
|
14 |
+
"id2label": {
|
15 |
+
"0": "Reason",
|
16 |
+
"1": "Statement",
|
17 |
+
"2": "Notification",
|
18 |
+
"3": "None"
|
19 |
+
},
|
20 |
+
"initializer_range": 0.02,
|
21 |
+
"intermediate_size": 3072,
|
22 |
+
"label2id": {
|
23 |
+
"None": 3,
|
24 |
+
"Notification": 2,
|
25 |
+
"Reason": 0,
|
26 |
+
"Statement": 1
|
27 |
+
},
|
28 |
+
"layer_norm_eps": 1e-05,
|
29 |
+
"max_position_embeddings": 130,
|
30 |
+
"model_type": "roberta",
|
31 |
+
"num_attention_heads": 12,
|
32 |
+
"num_hidden_layers": 12,
|
33 |
+
"pad_token_id": 1,
|
34 |
+
"position_embedding_type": "absolute",
|
35 |
+
"problem_type": "single_label_classification",
|
36 |
+
"tokenizer_class": "BertweetTokenizer",
|
37 |
+
"torch_dtype": "float32",
|
38 |
+
"transformers_version": "4.30.2",
|
39 |
+
"type_vocab_size": 1,
|
40 |
+
"use_cache": true,
|
41 |
+
"vocab_size": 64001
|
42 |
+
}
|
model_args.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"adafactor_beta1": null, "adafactor_clip_threshold": 1.0, "adafactor_decay_rate": -0.8, "adafactor_eps": [1e-30, 0.001], "adafactor_relative_step": true, "adafactor_scale_parameter": true, "adafactor_warmup_init": true, "adam_betas": [0.9, 0.999], "adam_epsilon": 1e-08, "best_model_dir": "outputs/best_model", "cache_dir": "cache_dir/", "config": {}, "cosine_schedule_num_cycles": 0.5, "custom_layer_parameters": [], "custom_parameter_groups": [], "dataloader_num_workers": 0, "do_lower_case": false, "dynamic_quantize": false, "early_stopping_consider_epochs": false, "early_stopping_delta": 0, "early_stopping_metric": "eval_loss", "early_stopping_metric_minimize": true, "early_stopping_patience": 3, "encoding": null, "eval_batch_size": 8, "evaluate_during_training": false, "evaluate_during_training_silent": true, "evaluate_during_training_steps": 2000, "evaluate_during_training_verbose": false, "evaluate_each_epoch": true, "fp16": true, "gradient_accumulation_steps": 1, "learning_rate": 4e-05, "local_rank": -1, "logging_steps": 50, "loss_type": null, "loss_args": {}, "manual_seed": null, "max_grad_norm": 1.0, "max_seq_length": 128, "model_name": "vinai/bertweet-base", "model_type": "bertweet", "multiprocessing_chunksize": -1, "n_gpu": 1, "no_cache": true, "no_save": false, "not_saved_args": [], "num_train_epochs": 5, "optimizer": "AdamW", "output_dir": "./model/TACO", "overwrite_output_dir": true, "polynomial_decay_schedule_lr_end": 1e-07, "polynomial_decay_schedule_power": 1.0, "process_count": 1, "quantized_model": false, "reprocess_input_data": true, "save_best_model": true, "save_eval_checkpoints": false, "save_model_every_epoch": false, "save_optimizer_and_scheduler": true, "save_steps": 2000, "scheduler": "linear_schedule_with_warmup", "silent": false, "skip_special_tokens": true, "tensorboard_dir": null, "thread_count": null, "tokenizer_name": "vinai/bertweet-base", "tokenizer_type": null, "train_batch_size": 8, "train_custom_parameters_only": false, "use_cached_eval_features": false, "use_early_stopping": false, "use_hf_datasets": false, "use_multiprocessing": true, "use_multiprocessing_for_evaluation": true, "wandb_kwargs": {}, "wandb_project": null, "warmup_ratio": 0.06, "warmup_steps": 66, "weight_decay": 0.0, "model_class": "ClassificationModel", "labels_list": [0, 1, 2, 3], "labels_map": {}, "lazy_delimiter": "\t", "lazy_labels_column": 1, "lazy_loading": false, "lazy_loading_start_line": 1, "lazy_text_a_column": null, "lazy_text_b_column": null, "lazy_text_column": 0, "onnx": false, "regression": false, "sliding_window": false, "special_tokens_list": [], "stride": 0.8, "tie_value": 1}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4056bc4e6aada20e6f8caafd283078b609ab06cd6bb1fa1cba8fc28b74d600c1
|
3 |
+
size 539682485
|
special_tokens_map.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "<s>",
|
3 |
+
"cls_token": "<s>",
|
4 |
+
"eos_token": "</s>",
|
5 |
+
"mask_token": "<mask>",
|
6 |
+
"pad_token": "<pad>",
|
7 |
+
"sep_token": "</s>",
|
8 |
+
"unk_token": "<unk>"
|
9 |
+
}
|
tokenizer_config.json
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "<s>",
|
3 |
+
"clean_up_tokenization_spaces": true,
|
4 |
+
"cls_token": "<s>",
|
5 |
+
"do_lower_case": false,
|
6 |
+
"eos_token": "</s>",
|
7 |
+
"mask_token": "<mask>",
|
8 |
+
"model_max_length": 128,
|
9 |
+
"normalization": true,
|
10 |
+
"pad_token": "<pad>",
|
11 |
+
"sep_token": "</s>",
|
12 |
+
"tokenizer_class": "BertweetTokenizer",
|
13 |
+
"unk_token": "<unk>"
|
14 |
+
}
|
training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eb8e68af90bd93faab831a5666ee353336ee96fd6f70a8c18fc486f51acbd20f
|
3 |
+
size 3195
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|