Mohamadlh commited on
Commit
58567f4
1 Parent(s): ad4180c

Upload 9 files

Browse files
.gitattributes CHANGED
@@ -25,7 +25,6 @@
25
  *.safetensors filter=lfs diff=lfs merge=lfs -text
26
  saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
  *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
  *.tflite filter=lfs diff=lfs merge=lfs -text
30
  *.tgz filter=lfs diff=lfs merge=lfs -text
31
  *.wasm filter=lfs diff=lfs merge=lfs -text
 
25
  *.safetensors filter=lfs diff=lfs merge=lfs -text
26
  saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
  *.tar.* filter=lfs diff=lfs merge=lfs -text
 
28
  *.tflite filter=lfs diff=lfs merge=lfs -text
29
  *.tgz filter=lfs diff=lfs merge=lfs -text
30
  *.wasm filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - AyoubChLin/CNN_News_Articles_2011-2022
5
+ language:
6
+ - en
7
+ metrics:
8
+ - accuracy
9
+ pipeline_tag: text-classification
10
+ tags:
11
+ - news classification
12
+ widget:
13
+ - text: money in the pocket
14
+ - text: no one can win this cup in quatar..
15
+ ---
16
+ # Fine-Tuned BART Model for Text Classification on CNN News Articles
17
+
18
+
19
+ This is a fine-tuned BART (Bidirectional and Auto-Regressive Transformers) model for text classification on CNN news articles. The model was fine-tuned on a dataset of CNN news articles with labels indicating the article topic, using a batch size of 32, learning rate of 6e-5, and trained for one epoch.
20
+
21
+ ## How to Use
22
+
23
+ ### Install
24
+
25
+ ```bash
26
+ pip install transformers
27
+ ```
28
+
29
+ ### Example Usage
30
+
31
+ ```python
32
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
33
+
34
+ tokenizer = AutoTokenizer.from_pretrained("IT-community/BART_cnn_news_text_classification")
35
+ model = AutoModelForSequenceClassification.from_pretrained("IT-community/BART_cnn_news_text_classification")
36
+
37
+ # Tokenize input text
38
+ text = "This is an example CNN news article about politics."
39
+ inputs = tokenizer(text, padding=True, truncation=True, max_length=512, return_tensors="pt")
40
+
41
+ # Make prediction
42
+ outputs = model(inputs["input_ids"], attention_mask=inputs["attention_mask"])
43
+ predicted_label = torch.argmax(outputs.logits)
44
+
45
+ print(predicted_label)
46
+ ```
47
+ ## Evaluation
48
+
49
+ The model achieved the following performance metrics on the test set:
50
+
51
+ Accuracy: 0.9591836734693877
52
+
53
+ F1-score: 0.958301875401112
54
+
55
+ Recall: 0.9591836734693877
56
+
57
+ Precision: 0.9579673040369542
58
+
59
+
60
+ ## About Us
61
+
62
+ We are a scientific club from Saad Dahleb Blida University named IT Community, created in 2016 by students. We are interested in all IT fields,
63
+ This work was done by IT Community Club.
64
+
65
+ ### Contributions
66
+
67
+ [Cherguelaine Ayoub](https://huggingface.co/AyoubChLin):
68
+
69
+ - Added preprocessing code for CNN news articles
70
+
71
+ - Improved model performance with additional fine-tuning on a larger dataset
config.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "ModelTC/bart-base-mnli",
3
+ "activation_dropout": 0.1,
4
+ "activation_function": "gelu",
5
+ "add_bias_logits": false,
6
+ "add_final_layer_norm": false,
7
+ "architectures": [
8
+ "BartForSequenceClassification"
9
+ ],
10
+ "attention_dropout": 0.1,
11
+ "bos_token_id": 0,
12
+ "classif_dropout": 0.1,
13
+ "classifier_dropout": 0.0,
14
+ "d_model": 768,
15
+ "decoder_attention_heads": 12,
16
+ "decoder_ffn_dim": 3072,
17
+ "decoder_layerdrop": 0.0,
18
+ "decoder_layers": 6,
19
+ "decoder_start_token_id": 2,
20
+ "dropout": 0.1,
21
+ "early_stopping": true,
22
+ "encoder_attention_heads": 12,
23
+ "encoder_ffn_dim": 3072,
24
+ "encoder_layerdrop": 0.0,
25
+ "encoder_layers": 6,
26
+ "eos_token_id": 2,
27
+ "finetuning_task": "mnli",
28
+ "forced_eos_token_id": 2,
29
+ "gradient_checkpointing": false,
30
+ "id2label": {
31
+ "0": "business",
32
+ "1": "entertainment",
33
+ "2": "health",
34
+ "3": "news",
35
+ "4": "politics",
36
+ "5": "sport"
37
+ },
38
+ "init_std": 0.02,
39
+ "is_encoder_decoder": true,
40
+ "label2id": {
41
+ "business": 0,
42
+ "entertainment": 1,
43
+ "health": 2,
44
+ "news": 3,
45
+ "politics": 4,
46
+ "sport": 5
47
+ },
48
+ "max_position_embeddings": 1024,
49
+ "model_type": "bart",
50
+ "no_repeat_ngram_size": 3,
51
+ "normalize_before": false,
52
+ "normalize_embedding": true,
53
+ "num_beams": 4,
54
+ "num_hidden_layers": 6,
55
+ "pad_token_id": 1,
56
+ "problem_type": "single_label_classification",
57
+ "scale_embedding": false,
58
+ "task_specific_params": {
59
+ "summarization": {
60
+ "length_penalty": 1.0,
61
+ "max_length": 128,
62
+ "min_length": 12,
63
+ "num_beams": 4
64
+ },
65
+ "summarization_cnn": {
66
+ "length_penalty": 2.0,
67
+ "max_length": 142,
68
+ "min_length": 56,
69
+ "num_beams": 4
70
+ },
71
+ "summarization_xsum": {
72
+ "length_penalty": 1.0,
73
+ "max_length": 62,
74
+ "min_length": 11,
75
+ "num_beams": 6
76
+ }
77
+ },
78
+ "torch_dtype": "float32",
79
+ "transformers_version": "4.27.4",
80
+ "use_cache": true,
81
+ "vocab_size": 50265
82
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:de593ead7b6f63572ead1ddbf19fc10ff7160670e44472e6fffaab205db74585
3
+ size 560151849
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "cls_token": "<s>",
4
+ "eos_token": "</s>",
5
+ "mask_token": {
6
+ "content": "<mask>",
7
+ "lstrip": true,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "pad_token": "<pad>",
13
+ "sep_token": "</s>",
14
+ "unk_token": "<unk>"
15
+ }
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
+ "add_prefix_space": false,
3
+ "bos_token": "<s>",
4
+ "cls_token": "<s>",
5
+ "eos_token": "</s>",
6
+ "errors": "replace",
7
+ "mask_token": "<mask>",
8
+ "model_max_length": 1000000000000000019884624838656,
9
+ "pad_token": "<pad>",
10
+ "sep_token": "</s>",
11
+ "special_tokens_map_file": null,
12
+ "tokenizer_class": "BartTokenizer",
13
+ "trim_offsets": true,
14
+ "unk_token": "<unk>"
15
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff