Model Card for gpt2-vietnamese-medium-instruct-bf16

This model is a fine-tuned version of chronopt-research/vietnamese-gpt2-medium. It has been trained using TRL.

Simple chat template

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "binhphap5/gpt2-vietnamese-medium-instruct-bf16"

model = AutoModelForCausalLM.from_pretrained(
    model_name,
    device_map="cuda:0",
    torch_dtype = torch.bfloat16, # or float16
)


tokenizer = AutoTokenizer.from_pretrained(
    model_name,
)

template = """### Instruction:
{}

### Input:
{}

### Response:
{}"""

instructions = 'Trình bày từng bước để học tiếng Anh tốt.'
inputs = ''
response = ''
prompt = template.format(instructions, inputs, response)

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
    **inputs,
    max_new_tokens=256,
    do_sample=True,
    temperature=0.7,
    top_k=50,
    top_p=0.95,
    repetition_penalty=1.1,
    eos_token_id=tokenizer.eos_token_id,
    pad_token_id=tokenizer.pad_token_id,
)
print(tokenizer.decode(outputs[0], skip_special_tokens=False))

Here is an example output you can expect from the above code:

image/png

Training procedure

This model was trained with SFT.

Framework versions

  • TRL: 0.16.1
  • Transformers: 4.51.3
  • Pytorch: 2.6.0+cu124
  • Datasets: 3.0.1
  • Tokenizers: 0.21.1

Citations

Cite TRL as:

@misc{vonwerra2022trl,
    title        = {{TRL: Transformer Reinforcement Learning}},
    author       = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallouédec},
    year         = 2020,
    journal      = {GitHub repository},
    publisher    = {GitHub},
    howpublished = {\url{https://github.com/huggingface/trl}}
}
Downloads last month
436
Safetensors
Model size
355M params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for binhphap5/gpt2-vietnamese-medium-instruct-bf16

Finetuned
(2)
this model