Downloads · 30 days
12
7% of all-time downloads
augustoafleal/gpt2-ptbr-218m
gpt2-ptbr-218m is a text generation model from augustoafleal. Use it when you need the model to write or continue text. The card lists the license as mit.
Portuguese GPT-2-like autoregressive language model trained from scratch.
Downloads · 30 days
12
7% of all-time downloads
All-time downloads
161
Public
Parameters
235M
939 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors938 MB · 100%
From the Hugging Face model README
Portuguese GPT-2-like autoregressive language model trained from scratch.
The released model, gpt2-ptbr-218m, is the final checkpoint of a three-stage pipeline:
The released checkpoint corresponds to the final instruction-tuned model.
Note on parameter count: During export, the weight-tying between the token embedding and the language model head is preserved, and zero-initialized bias tensors are added for compatibility with Hugging Face's
GPT2LMHeadModel. These biases are not part of the original trained model and do not affect behavior.
<unk> = 0, <bos> = 1, <eos> = 2, <pad> = 3The tokenizer was trained from scratch on the Portuguese Wikipedia corpus.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "augustoafleal/gpt2-ptbr-218m"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
prompt = "A inteligência artificial é"
inputs = tokenizer(prompt, return_tensors="pt")
output = model.generate(
**inputs,
max_new_tokens=100,
do_sample=True,
temperature=0.7,
top_k=40,
pad_token_id=tokenizer.pad_token_id,
eos_token_id=tokenizer.eos_token_id,
)
print(tokenizer.decode(output[0], skip_special_tokens=True))
Stanford Alpaca: Taori et al., 2023. https://github.com/tatsu-lab/stanford_alpaca
Canarim-Instruct-PTBR: Domingues, 2023. https://huggingface.co/datasets/dominguesm/Canarim-Instruct-PTBR
If you use this model, please cite:
@misc{gpt2ptbr218m,
title = {gpt2-ptbr-218m: A Portuguese GPT-2-like Autoregressive Language Model},
author = {Augusto Antônio Fontanive Leal},
year = {2026},
howpublished = {\url{https://huggingface.co/augustoafleal/gpt2-ptbr-218m}}
}