Mr-Vicky-01
commited on
Commit
•
49efb57
1
Parent(s):
3fb22f2
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,35 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
datasets:
|
4 |
+
- databricks/databricks-dolly-15k
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
metrics:
|
8 |
+
- rouge
|
9 |
+
library_name: transformers
|
10 |
---
|
11 |
+
# Uploaded model
|
12 |
+
|
13 |
+
- **Developed by:** [Vicky](https://huggingface.co/Mr-Vicky-01)
|
14 |
+
- **License:** mit
|
15 |
+
- **Finetuned from model :** Mr-Vicky-01/Bart-Finetuned-conversational-summarization
|
16 |
+
|
17 |
+
# Inference
|
18 |
+
|
19 |
+
```
|
20 |
+
# Load model directly
|
21 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
22 |
+
|
23 |
+
tokenizer = AutoTokenizer.from_pretrained("Mr-Vicky-01/Facebook-Bart-Qna")
|
24 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("Mr-Vicky-01/Facebook-Bart-Qna")
|
25 |
+
|
26 |
+
def generate_answer(text):
|
27 |
+
inputs = tokenizer([text], return_tensors='pt', truncation=True)
|
28 |
+
summary_ids = model.generate(inputs['input_ids'], max_length=512)
|
29 |
+
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
30 |
+
return summary
|
31 |
+
|
32 |
+
text_to_summarize = """Please answer this question: What is Artifical Intelligence?"""
|
33 |
+
summary = generate_answer(text_to_summarize)
|
34 |
+
print(summary)
|
35 |
+
```
|