Edit model card

typhoon-7b-WangchanX-sft-Demo

This model is based on WangchanX Fine-tuning Pipeline.

GitHub: WangchanX Fine-tuning Pipeline. Pre-train model from scb10x/typhoon-7b and fine tuning with Qlora.

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/typhoon-7b-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|>
ต่างกันที่วัฒนธรรมการแสดง ลิเกเป็นละครเพลงของไทย ส่วนงิ้วเป็นการแสดงพื้นบ้านของจีน
Downloads last month
9
Safetensors
Model size
7.27B 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/typhoon-7b-WangchanX-sft-Demo