Spaces:
Sleeping
Sleeping
reduce processing time
Browse files
app.py
CHANGED
@@ -44,16 +44,20 @@ async def summarize(req: Request, body: SummarizeRequest):
|
|
44 |
attention_mask = encoding["attention_mask"].to(device)
|
45 |
|
46 |
# Sinh tóm tắt với cấu hình ổn định
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
outputs = model.generate(
|
48 |
-
input_ids=input_ids,
|
49 |
-
|
50 |
-
|
51 |
-
num_beams=1,
|
52 |
-
early_stopping=True,
|
53 |
-
no_repeat_ngram_size=2,
|
54 |
-
num_return_sequences=1
|
55 |
)
|
56 |
-
|
57 |
summary = tokenizer.decode(outputs[0], skip_special_tokens=True, clean_up_tokenization_spaces=True)
|
58 |
|
59 |
end_time = time.time()
|
|
|
44 |
attention_mask = encoding["attention_mask"].to(device)
|
45 |
|
46 |
# Sinh tóm tắt với cấu hình ổn định
|
47 |
+
# outputs = model.generate(
|
48 |
+
# input_ids=input_ids,
|
49 |
+
# attention_mask=attention_mask,
|
50 |
+
# max_length=128,
|
51 |
+
# num_beams=1,
|
52 |
+
# early_stopping=True,
|
53 |
+
# no_repeat_ngram_size=2,
|
54 |
+
# num_return_sequences=1
|
55 |
+
# )
|
56 |
outputs = model.generate(
|
57 |
+
input_ids=input_ids, attention_mask=attention_masks,
|
58 |
+
max_length=256,
|
59 |
+
early_stopping=True
|
|
|
|
|
|
|
|
|
60 |
)
|
|
|
61 |
summary = tokenizer.decode(outputs[0], skip_special_tokens=True, clean_up_tokenization_spaces=True)
|
62 |
|
63 |
end_time = time.time()
|