Instructions to use chronopt-research/vietnamese-gpt2-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use chronopt-research/vietnamese-gpt2-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="chronopt-research/vietnamese-gpt2-base")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("chronopt-research/vietnamese-gpt2-base") model = AutoModelForCausalLM.from_pretrained("chronopt-research/vietnamese-gpt2-base") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use chronopt-research/vietnamese-gpt2-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "chronopt-research/vietnamese-gpt2-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chronopt-research/vietnamese-gpt2-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/chronopt-research/vietnamese-gpt2-base
- SGLang
How to use chronopt-research/vietnamese-gpt2-base with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "chronopt-research/vietnamese-gpt2-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chronopt-research/vietnamese-gpt2-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "chronopt-research/vietnamese-gpt2-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chronopt-research/vietnamese-gpt2-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use chronopt-research/vietnamese-gpt2-base with Docker Model Runner:
docker model run hf.co/chronopt-research/vietnamese-gpt2-base
Vietnamese gpt2-base
This is a pretrained gpt2-base for Vietnamese language using casual language modeling (CLM) objective. It was introduced in
this paper
and first released at this page.
Model Description
GPT-2 (at first) is a transformers model pretrained on a very large corpus of English data in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it was trained to guess the next word in sentences.
This is the base version of GPT-2, with 137M parameters.
You could've found other pretrained version from here: gpt2-medium, gpt2-large
Dataset used for pretraining
This is a combination of multiple Vietnamese dataset for pretraining CLMs such as GPT, GPT2, etc.
The dataset consists of:
vietgpt/covid_19_news_vihieunguyen1053/binhvq-news-corpusoscar (unshuffled_deduplicated_vi)vietgpt/wikipedia_vi
You can find out the combined version here: duongttr/vi-dataset-for-pretrain
Hyperparamters & Results
We trained the model ~100k steps, with lr=1e-4, bs=2560 (single_batch_size=32 * num_core=8 * grad_cum=10), optimizer=adamw on TPU-VM-3.8 from TRC Program. The training costs around 1 day.
| Model | Eval Loss | Eval Perplexity |
|---|---|---|
| gpt2-base | 3.939 | 51.35 |
| gpt2-medium | 2.8676 | 17.5948 |
| gpt2-large | - | - |
Contacts
Feel free to contact us via: email
- Downloads last month
- 13
Dataset used to train chronopt-research/vietnamese-gpt2-base
Evaluation results
- perplexityself-reported51.350