Downloads · 30 days
7
2% of all-time downloads
VLAI-AIVN/gpt2-aio-continued-pretraining-poem
gpt2-aio-continued-pretraining-poem is a text generation model from VLAI-AIVN. Use it when you need the model to write or continue text. It is set up for transformers.
VLAI-AIVN/gpt2-aio-continued-pretraining-poem is a Vietnamese GPT-2 causal language model adapted for poem-style generation through continued pretraining on a Vietnamese poem stanza corpus.
Downloads · 30 days
7
2% of all-time downloads
All-time downloads
359
Public
Parameters
124M
249 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors249 MB · 98%
From the Hugging Face model README
VLAI-AIVN/gpt2-aio-continued-pretraining-poem is a Vietnamese GPT-2 causal language model adapted for poem-style generation through continued pretraining on a Vietnamese poem stanza corpus.
This checkpoint is a stage-2 domain adaptation model. It starts from a general Vietnamese GPT-2 checkpoint from the same project and is then continued-pretrained on poem data. It is not an instruction-tuned chat model.
GPT2LMHeadModelsafetensorsThis model was continued-pretrained on the poem corpus:
Dataset size used by the training script:
27662489277Training examples are prepared as follows:
thơ:\nmax_length=64This means the model is best prompted with the same prefix used during training.
Important detail: despite the local folder name sft_poem, this run is not supervised fine-tuning in the instruction-tuning sense. It is continued pretraining for poem-domain adaptation.
The training script loads a previously pretrained Vietnamese GPT-2 checkpoint from the same project and continues training it on the poem corpus. In local project config, the base checkpoint is referenced by MODEL_DIR, set to ./artifacts/checkpoints/rand-init/checkpoint-8000.
Saved training arguments from this checkpoint:
| Setting | Value |
|---|---|
num_train_epochs | 30 |
per_device_train_batch_size | 32 |
per_device_eval_batch_size | 32 |
learning_rate | 5e-5 |
weight_decay | 0.1 |
warmup_ratio | 0.1 |
lr_scheduler_type | cosine |
bf16 | true |
fp16 | false |
eval_strategy | epoch |
save_strategy | epoch |
logging_steps | 10 |
save_total_limit | 2 |
load_best_model_at_end | true |
seed | 42 |
This point matters for anyone using or comparing the uploaded model:
global_step=2340 over 30 epochscheckpoint-468eval_loss=4.67436.0The project uses load_best_model_at_end=True, and the saved file hash confirms that:
final/model.safetensors is identical to checkpoint-468/model.safetensorsfinal/model.safetensors is different from checkpoint-2340/model.safetensorsSo the final/ folder being uploaded contains the best checkpoint weights, not the last checkpoint weights.
Recovered from trainer_state.json:
4.6743107.164686.0For reference, the last logged training state before training ended was:
23404.93512.6105The uploaded final/ model corresponds to the best checkpoint section above.
Use the training prefix thơ:\n in prompts for the most consistent behavior.
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "VLAI-AIVN/gpt2-aio-continued-pretraining-poem"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype="auto",
device_map="auto",
)
prompt = "thơ:\nTrăng lên đầu núi"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=64,
do_sample=True,
temperature=0.8,
top_p=0.95,
repetition_penalty=1.1,
pad_token_id=tokenizer.eos_token_id,
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
This checkpoint comes from the Vietnamese GPT-2 pretraining project in this repository, which includes:
If you use this model, cite the repository or link back to the Hugging Face model page.