Pretrained gpt model on Vietnamese language using a causal language modeling (CLM) objective. It was introduced in
this paper
and first released at
this page
.
How to use the model
import torch
from transformers import GPT2Tokenizer, GPT2LMHeadModel
tokenizer = GPT2Tokenizer.from_pretrained('NlpHUST/gpt2-vietnamese')
model = GPT2LMHeadModel.from_pretrained('NlpHUST/gpt2-vietnamese')
text = "Việt Nam là quốc gia có"
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,
top_k=40,
num_beams=5,
early_stopping=True,
no_repeat_ngram_size=2,
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---')
>> Generated text 1
Việt Nam là quốc gia có nền kinh tế hàng đầu thế giới về sản xuất, chế biến và tiêu thụ các sản phẩm nông sản, thủy sản. Tuy nhiên, trong những năm gần đây, nông nghiệp Việt Nam đang phải đối mặt với nhiều khó khăn, thách thức, đặc biệt là những tác động tiêu cực của biến đổi khí hậu.
Theo số liệu của Tổng cục Thống kê, tính đến cuối năm 2015, tổng diện tích gieo trồng, sản lượng lương thực, thực phẩm cả
---
>> Generated text 2
Việt Nam là quốc gia có nền kinh tế thị trường định hướng xã hội chủ nghĩa, có vai trò rất quan trọng đối với sự phát triển bền vững của đất nước. Do đó, trong quá trình đổi mới và hội nhập quốc tế, Việt Nam đã và đang phải đối mặt với không ít khó khăn, thách thức, đòi hỏi phải có những chủ trương, chính sách đúng đắn, kịp thời, phù hợp với tình hình thực tế. Để thực hiện thắng lợi mục tiêu, nhiệm vụ
---
>> Generated text 3
Việt Nam là quốc gia có nền kinh tế thị trường phát triển theo định hướng xã hội chủ nghĩa. Trong quá trình đổi mới và hội nhập quốc tế hiện nay, Việt Nam đang phải đối mặt với nhiều khó khăn, thách thức, đòi hỏi phải có những giải pháp đồng bộ, hiệu quả và phù hợp với tình hình thực tế của đất nước. Để thực hiện thắng lợi mục tiêu, nhiệm vụ mà Nghị quyết Đại hội XI của Đảng đề ra, Đảng và Nhà nước đã ban hành
---
Model architecture
A 12-layer, 768-hidden-size transformer-based language model.
Training
The model was trained on Vietnamese Oscar dataset (32 GB) to optimize a traditional language modelling objective on v3-8 TPU for around 6 days. It reaches around 13.4 perplexity on a chosen validation set from Oscar.
GPT-2 Finetuning
The following example fine-tunes GPT-2 on WikiText-2. We're using the raw WikiText-2.
For personal communication related to this project, please contact Nha Nguyen Van (
[email protected]
).
Runs of NlpHUST gpt2-vietnamese on huggingface.co
796
Total runs
0
24-hour runs
-8
3-day runs
-52
7-day runs
166
30-day runs
More Information About gpt2-vietnamese huggingface.co Model
gpt2-vietnamese huggingface.co
gpt2-vietnamese huggingface.co is an AI model on huggingface.co that provides gpt2-vietnamese's model effect (), which can be used instantly with this NlpHUST gpt2-vietnamese model. huggingface.co supports a free trial of the gpt2-vietnamese model, and also provides paid use of the gpt2-vietnamese. Support call gpt2-vietnamese model through api, including Node.js, Python, http.
gpt2-vietnamese huggingface.co is an online trial and call api platform, which integrates gpt2-vietnamese's modeling effects, including api services, and provides a free online trial of gpt2-vietnamese, you can try gpt2-vietnamese online for free by clicking the link below.
NlpHUST gpt2-vietnamese online free url in huggingface.co:
gpt2-vietnamese is an open source model from GitHub that offers a free installation service, and any user can find gpt2-vietnamese on GitHub to install. At the same time, huggingface.co provides the effect of gpt2-vietnamese install, users can directly use gpt2-vietnamese installed effect in huggingface.co for debugging and trial. It also supports api for free installation.