Edit model card

PolyLM-13b-WangchanX-sft-Demo

Built with PolyLM-13b (Fine tuning with Qlora)

This model is based on WangchanX Fine-tuning Pipeline.

GitHub: WangchanX Fine-tuning Pipeline.

License: cc-by-nc-3.0

Train Example

Train WangchanX pipeline: Colab

Inference Example

Run on Colab

Prepare your model and tokenizer:

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

# Model path
path = "airesearch/PolyLM-13b-WangchanX-sft-Demo"

# Device
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(path, use_fast=False)
model = AutoModelForCausalLM.from_pretrained(path, device_map="auto")

Define chat messages:

messages = [
    {"role": "user", "content": "รู้จักประเทศไทยไหม"},
]

Tokenize chat messages:

tokenized_chat = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(device)
print(tokenizer.decode(tokenized_chat[0]))
Output:
<|user|>
รู้จักประเทศไทยไหม
<|assistant|>

Generate responses:

outputs = model.generate(tokenized_chat, max_length=2048)
print(tokenizer.decode(outputs[0]))
Output:
<|user|>
รู้จักประเทศไทยไหม
<|assistant|>
ขอแนะนำให้ทราบว่า ประเทศไทยเป็นดินแดนที่มีความหลากหลายทางวัฒนธรรมและมีประเพณีที่งดงามมากมาย มีอารยะธรรมในอดีตที่มีมาตั้งแต่สมัยก่อนพุทธกาล เป็นศูนย์กลางของชาวเขาเผ่าต่างๆ ในเอเชีย และยังคงสภาพความรุ่งโรจน์ได้อย่างไม่น่าเชื่อด้วยการพัฒนาเศรษฐกิจที่เติบโตรวดเร็วที่สุดในภูมิภาคนี้ นอกจากนั้นแล้วก็ยังได้รับเลือกให้จัดการแข่งขันกีฬาซีเกมส์ครั้งล่าสุดเมื่อปี พ.ศ.2560 ซึ่งถือเป็นเหรียญเงินในการแข่งขันระดับอื่นอีกด้วย โดยปัจจุบันนี้มีการลงประชามติเพื่อรับรองการเข้าร่วมสหประชาชาติด้านมนุษยชน (ICCPR) เพื่อจะทำให้สามารถใช้สิทธิมนุษยชนตามอนุสัญญาสหประชาชาติเกี่ยวกับสิทธิมนุษยนชนหรือ ICCPR ได้เต็มอัตราส่วนเท่ากันกับนักศึกษาทั่วไป แต่เนื่องจากผู้คนจำนวนน้อยกว่า จึงไม่มีผลต่อการสมัครเรียน ครู หรือแม้กระทั้งคุณครูเองต้องยอมเหนื่อยกายใจทำงานเพิ่มขึ้นเพราะเด็กเล็กจำนวนหนึ่งเกิดใหม่ทุกวันโดยเฉพาะช่วงที่เปิดเทอมใหญ่ อยากฝึกงานทำวิทยาลัยที่สองเลยค่ะ ขอบพระคุณครับ
Downloads last month
9
Safetensors
Model size
13.9B params
Tensor type
F32
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Dataset used to train airesearch/PolyLM-13b-WangchanX-sft-Demo