Chi Honolulu commited on
Commit
dbe41d3
·
1 Parent(s): defda5a

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +59 -0
README.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ # For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
3
+ # Doc / guide: https://huggingface.co/docs/hub/model-cards
4
+ license: mit
5
+ language:
6
+ - cs
7
+ ---
8
+ # Model Card for mt5-base-binary-cs-iiia
9
+
10
+ <!-- Provide a quick summary of what the model is/does. -->
11
+
12
+ This model is fine-tuned for binary text classification of Supportive Interactions in Instant Messenger dialogs of Adolescents in Czech.
13
+
14
+ ## Model Description
15
+
16
+ The model was fine-tuned on a dataset of Czech Instant Messenger dialogs of Adolescents. The classification is binary and the model outputs 'positive' or 'negative': Supportive Interactions present or not. The inputs are a target utterance and its bi-directional context; it's target label that of the target utterance.
17
+
18
+ - **Developed by:** Anonymous
19
+ - **Language(s):** cs
20
+ - **Finetuned from:** mt5-base
21
+
22
+ ## Model Sources
23
+
24
+ <!-- Provide the basic links for the model. -->
25
+
26
+ - **Repository:** https://github.com/chi2024submission
27
+ - **Paper:** Stay tuned!
28
+
29
+ ## Usage
30
+ Here is how to use this model to classify a context-window of a dialogue:
31
+
32
+ ```python
33
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
34
+ import torch
35
+
36
+ test_texts = ['Utterance2']
37
+ test_text_pairs = ['Utterance1;Utterance2;Utterance3']
38
+
39
+ checkpoint_path = "chi2024/mt5-base-binary-cs-iiia"
40
+ model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint_path)\
41
+ .to("cuda" if torch.cuda.is_available() else "cpu")
42
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint_path)
43
+
44
+ def verbalize_input(text: str, text_pair: str) -> str:
45
+ return "Utterance: %s\nContext: %s" % (text, text_pair)
46
+
47
+ def predict_one(text, pair):
48
+ input_pair = verbalize_input(text, pair)
49
+ inputs = tokenizer(input_pair, return_tensors="pt", padding=True,
50
+ truncation=True, max_length=256).to(model.device)
51
+ outputs = model.generate(**inputs)
52
+ decoded = [text.strip() for text in
53
+ tokenizer.batch_decode(outputs, skip_special_tokens=True)]
54
+ return decoded
55
+
56
+ preds_txt = [predict_one(t,p) for t,p in zip(test_texts, test_text_pairs)]
57
+ preds_lbl = [1 if x == 'positive' else 0 for x in preds_txt]
58
+ print(preds_lbl)
59
+ ```