MuntasirHossain commited on
Commit
e287324
1 Parent(s): 6826688

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +65 -15
README.md CHANGED
@@ -12,21 +12,71 @@ model-index:
12
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
13
  should probably proofread and complete it, then remove this comment. -->
14
 
15
- # flan-t5-large-samsum-qlora
16
-
17
- This model is a fine-tuned version of [google/flan-t5-large](https://huggingface.co/google/flan-t5-large) on an unknown dataset.
18
-
19
- ## Model description
20
-
21
- More information needed
22
-
23
- ## Intended uses & limitations
24
-
25
- More information needed
26
-
27
- ## Training and evaluation data
28
-
29
- More information needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  ## Training procedure
32
 
 
12
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
13
  should probably proofread and complete it, then remove this comment. -->
14
 
15
+ # Model description
16
+
17
+ flan-t5-large-samsum-qlora is fine-tuned version of [google/flan-t5-large](https://huggingface.co/google/flan-t5-large) on the [samsum](is a fine-tuned version of ) dataset.
18
+ Parameter-efficient fine-tuning with QLoRA was employed to fine-tune the base model.
19
+
20
+ The model achieves the following scores on the test dataset:
21
+ - Rogue1: 49.249596%
22
+ - Rouge2: 23.513032%
23
+ - RougeL: 39.960812%
24
+ - RougeLsum: 39.968438%
25
+
26
+
27
+
28
+ ## How to use
29
+
30
+ Load the model:
31
+
32
+ ``` python
33
+ from peft import PeftModel, PeftConfig
34
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, BitsAndBytesConfig
35
+
36
+ # Load the peft adapter model config
37
+ peft_model_id = 'MuntasirHossain/flan-t5-large-samsum-qlora'
38
+ peft_config = PeftConfig.from_pretrained(peft_model_id)
39
+
40
+ # load the base model and tokenizer
41
+ base_model = AutoModelForSeq2SeqLM.from_pretrained(peft_config.base_model_name_or_path, load_in_8bit=True, device_map="auto")
42
+ tokenizer = AutoTokenizer.from_pretrained(peft_config.base_model_name_or_path)
43
+
44
+ # Load the peft model
45
+ model = PeftModel.from_pretrained(base_model, peft_model_id, device_map="auto")
46
+ model.eval()
47
+ ```
48
+
49
+ Example Inference:
50
+
51
+ ``` python
52
+ # random sample text from the samsum test dataset
53
+ text = """
54
+ Emma: Hi, we're going with Peter to Amiens tomorrow.
55
+ Daniel: oh! Cool.
56
+ Emma: Wanna join?
57
+ Daniel: Sure, I'm fed up with Paris.
58
+ Emma: We're too. The noise, traffic etc. Would be nice to see some countrysides.
59
+ Daniel: I don't think Amiens is exactly countrysides though :P
60
+ Emma: Nope. Hahahah. But not a megalopolis either!
61
+ Daniel: Right! Let's do it!
62
+ Emma: But we should leave early. The days are shorter now.
63
+ Daniel: Yes, the stupid winter time.
64
+ Emma: Exactly!
65
+ Daniel: Where should we meet then?
66
+ Emma: Come to my place by 9am.
67
+ Daniel: oohhh. It means I have to get up before 7!
68
+ Emma: Yup. The early bird gets the worm (in Amiens).
69
+ Daniel: You sound like my grandmother.
70
+ Emma: HAHAHA. I'll even add: no parties tonight, no drinking dear Daniel
71
+ Daniel: I really hope Amiens is worth it!
72
+ """
73
+
74
+ input = tokenizer(text, return_tensors="pt")
75
+ outputs = model.generate(input_ids=input["input_ids"].cuda(), max_new_tokens=40) # outputs = model.generate(input_ids=input["input_ids"].to('cuda'), max_new_tokens=50)
76
+ print("Summary: ", tokenizer.decode(outputs[0], skip_special_tokens=True))
77
+
78
+ Summary: Emma and Peter are going to Amiens tomorrow. Daniel will join them. They will meet at Emma's place by 9 am. They will not have any parties tonight.
79
+ ```
80
 
81
  ## Training procedure
82