Downloads · 30 days
15
1% of all-time downloads
juierror/thai-news-summarization
thai-news-summarization is a machine learning model from juierror. 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. The card lists the license as mit.
Downloads · 30 days
15
1% of all-time downloads
All-time downloads
2.1K
Public
Parameters
300M
3.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.bin1.2 GB · 50%
From the Hugging Face model README
from transformers import MT5Tokenizer, MT5ForConditionalGeneration
tokenizer = MT5Tokenizer.from_pretrained('juierror/thai-news-summarization')
model = MT5ForConditionalGeneration.from_pretrained('juierror/thai-news-summarization')
text = "some news with head line"
tokenized_text = tokenizer(text, truncation=True, padding=True, return_tensors='pt')
source_ids = tokenized_text['input_ids'].to("cpu", dtype = torch.long)
source_mask = tokenized_text['attention_mask'].to("cpu", dtype = torch.long)
generated_ids = model.generate(
input_ids = source_ids,
attention_mask = source_mask,
max_length=512,
num_beams=5,
repetition_penalty=1,
length_penalty=1,
early_stopping=True,
no_repeat_ngram_size=2
)
pred = tokenizer.decode(generated_ids[0], skip_special_tokens=True, clean_up_tokenization_spaces=True)