Downloads · 30 days
17
4% of all-time downloads
chieunq/vietnamese-sentence-paraphase-v1
vietnamese-sentence-paraphase-v1 is a machine learning model from chieunq. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
This is tool for paraphase Vietnamese sentence.
Downloads · 30 days
17
4% of all-time downloads
All-time downloads
450
Public
Repo size
2 GB
Likes
0
Public
Click a slice to open those files.
.bin1 GB · 100%
From the Hugging Face model README
This is tool for paraphase Vietnamese sentence.
CKPT = 'chieunq/vietnamese-sentence-paraphase-v1'
from transformers import MT5Tokenizer, MT5ForConditionalGeneration
tokenizer = MT5Tokenizer.from_pretrained(CKPT)
model = MT5ForConditionalGeneration.from_pretrained(CKPT)
def paraphase(text):
inputs = tokenizer(text, padding='longest', max_length=64, return_tensors='pt')
input_ids = inputs.input_ids
attention_mask = inputs.attention_mask
output = model.generate(input_ids, attention_mask=attention_mask, max_length=64)
return tokenizer.decode(output[0], skip_special_tokens=True)
texts = ["Làm sao để sống tốt đời đẹp đạo",
"Bài học tốt nhất trong cuộc sống là gì?",
"Các bước chuẩn bị phỏng vấn tại Google",
"Vì sao phụ nữ thường sống thọ hơn đàn ông?",
"Nắng nóng bắt đầu xảy ra ở nhiều nơi tại Bắc Bộ và sẽ tiếp tục tăng nhiệt trong vài ngày tới."
]
for text in texts:
print(f'Input: {text}')
print(f'Output: {paraphase(text)}')
print('-'*100)
Input: Làm sao để sống tốt đời đẹp đạo
Output: Làm thế nào để tôi sống tốt đẹp
----------------------------------------------------------------------------------------------------
Input: Bài học tốt nhất trong cuộc sống là gì?
Output: Bài học cuộc sống tốt nhất là gì?
----------------------------------------------------------------------------------------------------
Input: Các bước chuẩn bị phỏng vấn tại Google
Output: Các bước chuẩn bị cho cuộc phỏng vấn tại Google là gì?
----------------------------------------------------------------------------------------------------
Input: Vì sao phụ nữ thường sống thọ hơn đàn ông?
Output: Tại sao phụ nữ sống thọ hơn đàn ông?
----------------------------------------------------------------------------------------------------
Input: Nắng nóng bắt đầu xảy ra ở nhiều nơi tại Bắc Bộ và sẽ tiếp tục tăng nhiệt trong vài ngày tới.
Output: Nắng nóng bắt đầu xảy ra ở Bắc Bộ và sẽ tiếp tục tăng nhiệt trong vài ngày tới.
----------------------------------------------------------------------------------------------------