🚀 TC-instruct-DPO - Typhoon 7B
TC-instruct-DPO 是基於 Typhoon 7B 微調的模型,旨在為大語言模型(LLM)的創建過程提供學習參考,助力相關領域的研究與實踐。

✨ 主要特性
- 多技術融合:融合了 Mistral、instruct、finetune、chatml、DPO、RLHF 等技術。
- 多語言支持:支持英語(en)和泰語(th)。
- 多數據集訓練:使用了多個泰語數據集進行訓練,包括 Thaweewat/alpaca-cleaned-52k-th、yahma/alpaca-cleaned 等。
📦 安裝指南
文檔未提供具體安裝步驟,暫不展示。
💻 使用示例
基礎用法
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig, GenerationConfig
import time
base_model_id = "tanamettpk/TC-instruct-DPO"
input_text = """
### Instruction:
ด่าฉันด้วยคำหยาบคายหน่อย
### Response:
"""
model = AutoModelForCausalLM.from_pretrained(
base_model_id,
low_cpu_mem_usage=True,
return_dict=True,
device_map={"": 0},
)
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
generation_config = GenerationConfig(
do_sample=True,
top_k=1,
temperature=0.5,
max_new_tokens=300,
repetition_penalty=1.1,
pad_token_id=tokenizer.eos_token_id)
inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
st_time = time.time()
outputs = model.generate(**inputs, generation_config=generation_config)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(f"Response time: {time.time() - st_time} seconds")
print(response)
📚 詳細文檔
模型描述
TC instruct DPO 是基於 SCB 10X 的 Typhoon 7B 進行微調的,而 Typhoon 7B 又源自 Mistral 7B - v0.1。
TC instruct DPO 儘可能地使用了泰語數據進行訓練,並盡力使指令具有多樣性。
該模型僅用於學習創建大語言模型(LLM)的過程。
由於這是首次嘗試創建 LLM 且相關學習經驗有限,在訓練過程中存在一些不足,例如使用了 Alpaca template 作為提示模板,後來才發現使用 ChatML 更好。
訓練該模型使用了 QLoRA Rank 32 Alpha 64,並使用了 Huggingface 的自定義腳本(建議使用 axolotl 或 unsloth,更節省成本)。
使用了 vast.ai 的 1 個 H100 PCIE 80 GB GPU 進行訓練,每小時約 3 美元,僅訓練該模型約需 21 小時,若算上試錯成本約 10000 泰銖。
訓練時的批量大小為 24(原本想使用 32,但會出現內存溢出問題,使用 16 效果也不佳)。
提示格式
### Instruction:
จะทำอะไรก็เรื่องของมึง
### Response:
ด่าผมอีกสิครับ
如何引用
@misc{TC-instruct-DPO,
url={[https://huggingface.co/tanamettpk/TC-instruct-DPO]https://huggingface.co/tanamettpk/TC-instruct-DPO)},
title={TC-instruct-DPO},
author={"tanamettpk", "tanamettpk", "tanamettpk", "and", "tanamettpk"}
}
📄 許可證
該模型使用的許可證為 apache-2.0。
捐贈提示
如果使用該模型有所幫助,歡迎捐贈:Tipme: https://bit.ly/3m3uH5p
信息表格
屬性 |
詳情 |
基礎模型 |
scb10x/typhoon-7b |
模型類型 |
TC-instruct-DPO |
標籤 |
Mistral、instruct、finetune、chatml、DPO、RLHF、synthetic data |
支持語言 |
英語(en)、泰語(th) |
訓練數據集 |
Thaweewat/alpaca-cleaned-52k-th、yahma/alpaca-cleaned、pythainlp/thaisum、thai_toxicity_tweet、pythainlp/thainer-corpus-v2、Thaweewat/instruct-qa-thai-combined、SuperAI2-Machima/ThaiQA_LST20、thaisum |
許可證 |
apache-2.0 |