Downloads · 30 days
98
1% of all-time downloads
minhtoan/gpt2-vietnamese
gpt2-vietnamese is a text generation model from minhtoan. Use it when you need the model to write or continue text. It is set up for transformers.
GPT-2, a language pretrained model with a causal language modeling (CLM) goal, is a transformer-based language model. This model was pre-trained and used to generate text on the Vietnamese Wikilingua dataset.
Downloads · 30 days
98
1% of all-time downloads
All-time downloads
7K
Public
Repo size
1 GB
Likes
1
Public
Click a slice to open those files.
.bin510 MB · 100%
From the Hugging Face model README
GPT-2, a language pretrained model with a causal language modeling (CLM) goal, is a transformer-based language model. This model was pre-trained and used to generate text on the Vietnamese Wikilingua dataset.
from transformers import GPT2Tokenizer, GPT2LMHeadModel
tokenizer = GPT2Tokenizer.from_pretrained('minhtoan/vietnamese-gpt2-finetune')
model = GPT2LMHeadModel.from_pretrained('minhtoan/vietnamese-gpt2-finetune')
text = "Không phải tất cả các nguyên liệu lành mạnh đều đắt đỏ."
input_ids = tokenizer.encode(text, return_tensors='pt')
max_length = 100
sample_outputs = model.generate(input_ids,pad_token_id=tokenizer.eos_token_id,
do_sample=True,
max_length=max_length,
min_length=max_length,
num_return_sequences=3)
for i, sample_output in enumerate(sample_outputs):
print(">> Generated text {}\n\n{}".format(i+1, tokenizer.decode(sample_output.tolist())))
print('\n---')
Phan Minh Toan