Downloads · 30 days
20
0% of all-time downloads
airesearch/typhoon-7b-WangchanX-sft-Demo
typhoon-7b-WangchanX-sft-Demo is a text generation model from airesearch. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as cc-by-nc-3.0.
This model is based on WangchanX Fine-tuning Pipeline.
Downloads · 30 days
20
0% of all-time downloads
All-time downloads
4.4K
Public
Parameters
7.3B
58.1 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors58.1 GB · 100%
From the Hugging Face model README
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 WangchanX pipeline: Colab
Run on Colab
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")
messages = [
{"role": "user", "content": "ลิเก กับ งิ้ว ต่างกันอย่างไร"},
]
tokenized_chat = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(device)
print(tokenizer.decode(tokenized_chat[0]))
<details close>
<summary>Output: </summary>
<br>
<pre lang="markdown">
<|user|>
ลิเก กับ งิ้ว ต่างกันอย่างไร</s>
<|assistant|></pre>
</details>
outputs = model.generate(tokenized_chat, max_length=2048)
print(tokenizer.decode(outputs[0]))
<details close>
<summary>Output: </summary>
<br>
<pre lang="markdown">
<|user|>
ลิเก กับ งิ้ว ต่างกันอย่างไร</s>
<|assistant|>
ต่างกันที่วัฒนธรรมการแสดง ลิเกเป็นละครเพลงของไทย ส่วนงิ้วเป็นการแสดงพื้นบ้านของจีน</s></pre>
</details>