Update README.md
Browse files
README.md
CHANGED
@@ -1,14 +1,32 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
# Model Card for Model ID
|
7 |
|
8 |
-
|
9 |
|
|
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
|
|
12 |
## Model Details
|
13 |
|
14 |
### Model Description
|
@@ -35,7 +53,7 @@ This is the model card of a 🤗 transformers model that has been pushed on the
|
|
35 |
|
36 |
## Uses
|
37 |
|
38 |
-
|
39 |
|
40 |
### Direct Use
|
41 |
|
@@ -71,10 +89,39 @@ Users (both direct and downstream) should be made aware of the risks, biases and
|
|
71 |
|
72 |
Use the code below to get started with the model.
|
73 |
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
## Training Details
|
77 |
|
|
|
|
|
78 |
### Training Data
|
79 |
|
80 |
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
datasets:
|
4 |
+
- neil-code/dialogsum-test
|
5 |
+
base_model:
|
6 |
+
- TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
7 |
+
pipeline_tag: summarization
|
8 |
---
|
9 |
|
10 |
# Model Card for Model ID
|
11 |
|
12 |
+
This model summarizes dialogues between two persons.
|
13 |
|
14 |
+
This is a sample input for the model:
|
15 |
|
16 |
+
<PRE>
|
17 |
+
|
18 |
+
Instruct: Summarize the following conversation.
|
19 |
+
#Person1#: Happy Birthday, this is for you, Brian.
|
20 |
+
#Person2#: I'm so happy you remember, please come in and enjoy the party. Everyone's here, I'm sure you have a good time.
|
21 |
+
#Person1#: Brian, may I have a pleasure to have a dance with you?
|
22 |
+
#Person2#: Ok.
|
23 |
+
#Person1#: This is really wonderful party.
|
24 |
+
#Person2#: Yes, you are always popular with everyone. and you look very pretty today.
|
25 |
+
#Person1#: Thanks, that's very kind of you to say. I hope my necklace goes with my dress, and they both make me look good I feel.
|
26 |
+
#Person2#: You look great, you are absolutely glowing.
|
27 |
+
#Person1#: Thanks, this is a fine party. We should have a drink together to celebrate your birthday
|
28 |
|
29 |
+
</PRE>
|
30 |
## Model Details
|
31 |
|
32 |
### Model Description
|
|
|
53 |
|
54 |
## Uses
|
55 |
|
56 |
+
Format dialogue in accord to the sample prompt and you get a summary of the dialogue
|
57 |
|
58 |
### Direct Use
|
59 |
|
|
|
89 |
|
90 |
Use the code below to get started with the model.
|
91 |
|
92 |
+
```
|
93 |
+
import torch
|
94 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
95 |
+
|
96 |
+
model_name = "Kelmeilia/llama1_1chat-dialogsum-finetuned"
|
97 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, device_map='auto', torch_dtype=torch.float16, is_trainable=False)
|
98 |
+
|
99 |
+
eval_tokenizer = AutoTokenizer.from_pretrained(base_model_id, add_bos_token=True, trust_remote_code=True, use_fast=False)
|
100 |
+
eval_tokenizer.pad_token = eval_tokenizer.eos_token
|
101 |
+
|
102 |
+
dialogue = """ Joona: Can I have a banana, Ivana?
|
103 |
+
Ivana: No, I am out of bananas.
|
104 |
+
Joona: Give me an apple then?
|
105 |
+
Ivana: Sure, here you go
|
106 |
+
"""
|
107 |
+
|
108 |
+
prompt = f"Instruct: Summarize the following conversation.\n{dialogue}\nOutput:\n"
|
109 |
+
|
110 |
+
tokens = eval_tokenizer(p, return_tensors="pt")
|
111 |
+
result = model.generate(**tokens.to("cuda"), max_new_tokens=100, do_sample=True,num_return_sequences=1,temperature=0.1,num_beams=1,top_p=0.95,).to('cpu')
|
112 |
+
output = eval_tokenizer.batch_decode(result, skip_special_tokens=True)
|
113 |
|
114 |
+
|
115 |
+
|
116 |
+
dialogue_summary_str = output[0].split('Output:\n')[1]
|
117 |
+
|
118 |
+
print(dialogue_summary_str)
|
119 |
+
|
120 |
+
```
|
121 |
## Training Details
|
122 |
|
123 |
+
500 steps of Lora Finetuning
|
124 |
+
|
125 |
### Training Data
|
126 |
|
127 |
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|