hf_mirrors/gpt2-base-thai
Model Introduction
Files & versions
Analysis

GPT-2 Base Thai

GPT-2 Base Thai is a causal language model based on the OpenAI GPT-2 model. It was trained on the OSCAR dataset, specifically the unshuffled_deduplicated_th subset. The model was trained from scratch and achieved an evaluation loss of 1.708 and an evaluation perplexity of 5.516.

This model was trained using HuggingFace's Flax framework and is part of the JAX/Flax Community Week. All training was done on a TPUv3-8 VM, sponsored by the Google Cloud team.

Model

Model#paramsArch.Training/Validation data (text)
gpt2-base-thai124MGPT-2unshuffled_deduplicated_th Dataset

Evaluation Results

The model was trained for 3 epochs and the following is the final result once the training ended.

train lossvalid lossvalid PPLtotal time
1.6381.7085.5166:12:34

How to Use

As Causal Language Model

from openmind import pipeline
pretrained_name = "SY_AICC/gpt2-base-thai"
nlp = pipeline(
    "text-generation",
    model=pretrained_name,
    tokenizer=pretrained_name
)
nlp("สวัสดีตอนเช้า")

Feature Extraction in PyTorch

from openmind import AutoTokenizer, AutoModel
pretrained_name = "SY_AICC/gpt2-base-thai"
model = AutoModel.from_pretrained(pretrained_name)
tokenizer = AutoTokenizer.from_pretrained(pretrained_name)
prompt = "สวัสดีตอนเช้า"
encoded_input = tokenizer(prompt, return_tensors='pt')
output = model(**encoded_input)

Team Members

  • Sakares Saengkaew
  • Wilson Wongso