Chi Honolulu commited on
Commit
619860a
·
1 Parent(s): a6fbc46

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +60 -0
README.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ - multilingual
7
+ ---
8
+ # Model Card for mt5-base-multi-label-all-cs-iv
9
+
10
+ <!-- Provide a quick summary of what the model is/does. -->
11
+
12
+ This model is fine-tuned for multi-label seq2seq text classification of Supportive Interactions in Instant Messenger dialogs of Adolescents.
13
+
14
+ ## Model Description
15
+
16
+ The model was fine-tuned on a dataset of Czech Instant Messenger dialogs of Adolescents. The classification is multi-label. For each of the utterances in the input, the model outputs any combination of the tags:'NO TAG', 'Informační podpora', 'Emocionální podpora', 'Začlenění do skupiny', 'Uznání', 'Nabídka pomoci': as a string joined with ', ' (ordered alphabetically). Each label indicates the presence of that category of Supportive Interactions: 'no tag', 'informational support', 'emocional support', 'social companionship', 'appraisal', 'instrumental support' in each of the utterances of the input. The inputs of the model is a sequence of utterances joined with ';'. The outputs are a sequence of per-utterance labels such as: 'NO TAG; Informační podpora, Uznání; NO TAG'
17
+
18
+ - **Developed by:** Anonymous
19
+ - **Language(s):** multilingual
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
+ import itertools
34
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
35
+ import torch
36
+
37
+ # Target dialog context window
38
+ test_texts = ['Utterance1;Utterance2;Utterance3']
39
+
40
+ # Load the model and tokenizer
41
+ checkpoint_path = "chi2024/mt5-base-multi-label-all-cs-iv"
42
+ model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint_path)\
43
+ .to("cuda" if torch.cuda.is_available() else "cpu")
44
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint_path)
45
+
46
+ # Define helper functions
47
+ def predict_one(text):
48
+ inputs = tokenizer(text, return_tensors="pt", padding=True,
49
+ truncation=True, max_length=256).to(model.device)
50
+ outputs = model.generate(**inputs)
51
+ decoded = [text.split(",")[0].strip() for text in
52
+ tokenizer.batch_decode(outputs, skip_special_tokens=True)]
53
+ predicted_sequence = list(
54
+ itertools.chain(*(pred_one.split("; ") for pred_one in decoded)))
55
+ return predicted_sequence
56
+
57
+ # Run the prediction
58
+ dec = predict_one(test_texts[0])
59
+ print(dec)
60
+ ```