stefanoscotta
commited on
Commit
•
4b45407
1
Parent(s):
7ae627b
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,119 @@
|
|
1 |
-
---
|
2 |
-
license: unknown
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: unknown
|
3 |
+
datasets:
|
4 |
+
- raicrits/YouTube_RAI_dataset
|
5 |
+
language:
|
6 |
+
- it
|
7 |
+
pipeline_tag: text-classification
|
8 |
+
tags:
|
9 |
+
- LLM
|
10 |
+
- Italian
|
11 |
+
- Classification
|
12 |
+
- BERT
|
13 |
+
- Topics
|
14 |
+
library_name: transformers
|
15 |
+
---
|
16 |
+
|
17 |
+
---
|
18 |
+
|
19 |
+
# Model Card raicrits/Llama3_ChangeOfTopic
|
20 |
+
|
21 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
22 |
+
|
23 |
+
[bert-base-multilingual-cased](https://huggingface.co/bert-base-multilingual-cased) finetuned to be capable of detecting
|
24 |
+
a change of topic in a given text.
|
25 |
+
|
26 |
+
|
27 |
+
### Model Description
|
28 |
+
|
29 |
+
|
30 |
+
The model is finetuned for the specific task of detecting a change of topic in a given text. Given a text the model answers with "1" in the case that it detects a change of topic and "0" otherwise.
|
31 |
+
The training has been done using the chapters in the Youtube videos contained in the train split of the dataset [raicrits/YouTube_RAI_dataset](https://huggingface.co/meta-llama/raicrits/YouTube_RAI_dataset).
|
32 |
+
|
33 |
+
|
34 |
+
- **Developed by:** Stefano Scotta ([email protected])
|
35 |
+
- **Model type:** LLM finetuned on the specific task of detect a change of topic in a given text
|
36 |
+
- **Language(s) (NLP):** Italian
|
37 |
+
- **License:** unknown
|
38 |
+
- **Finetuned from model [optional]:** [bert-base-multilingual-cased](https://huggingface.co/bert-base-multilingual-cased)
|
39 |
+
|
40 |
+
|
41 |
+
## Uses
|
42 |
+
|
43 |
+
The model can be used to check if in a given text occurs a change of topic or not.
|
44 |
+
|
45 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
46 |
+
|
47 |
+
|
48 |
+
## How to Get Started with the Model
|
49 |
+
|
50 |
+
Use the code below to get started with the model.
|
51 |
+
|
52 |
+
**Usage:**
|
53 |
+
Use the code below to get started with the model.
|
54 |
+
``` python
|
55 |
+
|
56 |
+
import torch
|
57 |
+
from transformers import AutoTokenizer, BertForSequenceClassification, BertTokenizer, AutoModelForCausalLM, pipeline
|
58 |
+
|
59 |
+
|
60 |
+
model_bert = torch.load('/opt/data/AI4MEDIA/LLMProject/models/bert_multi_CT_30sec_shift10_weight_loss')
|
61 |
+
model_bert = model_bert.to(device_bert)
|
62 |
+
|
63 |
+
tokenizer_bert = AutoTokenizer.from_pretrained('bert-base-multilingual-cased')
|
64 |
+
|
65 |
+
encoded_dict = tokenizer_bert.encode_plus(
|
66 |
+
'<text>',
|
67 |
+
add_special_tokens = True,
|
68 |
+
max_length = 256,
|
69 |
+
# max_length = min(max_len, 512),
|
70 |
+
truncation = True,
|
71 |
+
padding='max_length',
|
72 |
+
return_attention_mask = True,
|
73 |
+
return_tensors = 'pt',
|
74 |
+
)
|
75 |
+
input_ids = encoded_dict['input_ids'].to(device_bert)
|
76 |
+
input_mask = encoded_dict['attention_mask'].to(device_bert)
|
77 |
+
with torch.no_grad():
|
78 |
+
output= model_bert(input_ids,
|
79 |
+
token_type_ids=None,
|
80 |
+
attention_mask=input_mask)
|
81 |
+
logits = output.logits
|
82 |
+
logits = logits.detach().cpu().numpy()
|
83 |
+
pred_flat = np.argmax(logits, axis=1).flatten()
|
84 |
+
print(pred_flat[0])
|
85 |
+
```
|
86 |
+
|
87 |
+
## Training Details
|
88 |
+
|
89 |
+
### Training Data
|
90 |
+
|
91 |
+
Chapters in the Youtube videos contained in the train split of the dataset [raicrits/YouTube_RAI_dataset](https://huggingface.co/meta-llama/raicrits/YouTube_RAI_dataset)
|
92 |
+
|
93 |
+
### Training Procedure
|
94 |
+
|
95 |
+
|
96 |
+
**Training setting:**
|
97 |
+
- train epochs=18,
|
98 |
+
|
99 |
+
- learning_rate=2e-05
|
100 |
+
|
101 |
+
|
102 |
+
## Environmental Impact
|
103 |
+
|
104 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
105 |
+
|
106 |
+
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
107 |
+
|
108 |
+
- **Hardware Type:** 1 NVIDIA A100/40Gb
|
109 |
+
- **Hours used:** 20
|
110 |
+
- **Cloud Provider:** Private Infrastructure
|
111 |
+
- **Carbon Emitted:** 2.38kg eq. CO2
|
112 |
+
|
113 |
+
## Model Card Authors
|
114 |
+
|
115 |
+
Stefano Scotta ([email protected])
|
116 |
+
|
117 |
+
## Model Card Contact
|
118 |
+
|
119 |