Shivanand Roy
commited on
Commit
·
9f9bcd7
1
Parent(s):
c2772e5
Update README.md
Browse files
README.md
CHANGED
@@ -3,31 +3,45 @@ A T5 model trained on 370,000 research papers, to generate one line summary base
|
|
3 |
|
4 |
## Usage
|
5 |
```python
|
6 |
-
model_name="snrspeaks/t5-one-line-summary"
|
7 |
|
8 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
9 |
|
10 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
11 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
12 |
|
13 |
-
abstract="""We describe a system called Overton, whose main design goal is to
|
14 |
-
in building, monitoring, and improving production machine learning systems.
|
15 |
-
face are monitoring fine-grained quality, diagnosing errors in
|
16 |
-
handling contradictory or incomplete supervision data.
|
17 |
-
construction, deployment, and monitoring by providing a
|
18 |
-
Overton's vision is to shift developers to
|
19 |
-
|
|
|
20 |
in frameworks like TensorFlow. For over a year, Overton has been used in production to support multiple
|
21 |
applications in both near-real-time applications and back-of-house processing.
|
22 |
In that time, Overton-based applications have answered billions of queries in multiple
|
23 |
languages and processed trillions of records reducing errors 1.7-2.9 times versus production systems.
|
24 |
"""
|
25 |
|
26 |
-
input_ids = tokenizer.encode(
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
print(preds)
|
33 |
|
|
|
3 |
|
4 |
## Usage
|
5 |
```python
|
6 |
+
model_name = "snrspeaks/t5-one-line-summary"
|
7 |
|
8 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
9 |
|
10 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
11 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
12 |
|
13 |
+
abstract = """We describe a system called Overton, whose main design goal is to
|
14 |
+
support engineers in building, monitoring, and improving production machine learning systems.
|
15 |
+
Key challenges engineers face are monitoring fine-grained quality, diagnosing errors in
|
16 |
+
sophisticated applications, and handling contradictory or incomplete supervision data.
|
17 |
+
Overton automates the life cycle of model construction, deployment, and monitoring by providing a
|
18 |
+
set of novel high-level, declarative abstractions. Overton's vision is to shift developers to
|
19 |
+
these higher-level tasks instead of lower-level machine learning tasks. In fact, using Overton,
|
20 |
+
engineers can build deep-learning-based applications without writing any code
|
21 |
in frameworks like TensorFlow. For over a year, Overton has been used in production to support multiple
|
22 |
applications in both near-real-time applications and back-of-house processing.
|
23 |
In that time, Overton-based applications have answered billions of queries in multiple
|
24 |
languages and processed trillions of records reducing errors 1.7-2.9 times versus production systems.
|
25 |
"""
|
26 |
|
27 |
+
input_ids = tokenizer.encode(
|
28 |
+
"summarize: " + abstract, return_tensors="pt", add_special_tokens=True
|
29 |
+
)
|
30 |
+
|
31 |
+
generated_ids = model.generate(
|
32 |
+
input_ids=input_ids,
|
33 |
+
num_beams=5,
|
34 |
+
max_length=50,
|
35 |
+
repetition_penalty=2.5,
|
36 |
+
length_penalty=1,
|
37 |
+
early_stopping=True,
|
38 |
+
num_return_sequences=3,
|
39 |
+
)
|
40 |
+
|
41 |
+
preds = [
|
42 |
+
tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=True)
|
43 |
+
for g in generated_ids
|
44 |
+
]
|
45 |
|
46 |
print(preds)
|
47 |
|