Taiwan LLM 是一款专为繁体中文打造的先进语言模型,专注于台湾的语言和文化语境。 该模型基于大型基础模型开发,通过多样化的台湾文本资源进行充实,并经过有监督微调优化。 此模型在语言理解和生成方面表现卓越,能紧密贴合台湾的文化细微差异。 它在 TC-Eval 等各类基准测试中展现出更优性能,彰显了其在语境理解和文化相关性方面的优势。 如需深入了解 Taiwan LLM 的开发过程和特性,请参阅我们的 技术报告。
以下是如何使用 🤗 Transformers 中的 pipeline() 函数运行模型的方法:
# pip install transformers>=4.34
# pip install accelerate
import torch
from openmind import pipeline
pipe = pipeline("text-generation", model="LF_AICC/Taiwan-LLM-7B-v2.1-chat", torch_dtype=torch.bfloat16, device_map="auto")
# We use the tokenizer's chat template to format each message
messages = [
{
"role": "system",
"content": "你是一個人工智慧助理",
},
{"role": "user", "content": "東北季風如何影響台灣氣候?"},
]
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
print(outputs[0]["generated_text"])训练过程中使用了以下超参数:
如果您发现Taiwan LLM对您的工作有帮助,请按以下方式引用:
@misc{lin2023taiwan,
title={Taiwan LLM: Bridging the Linguistic Divide with a Culturally Aligned Language Model},
author={Yen-Ting Lin and Yun-Nung Chen},
year={2023},
eprint={2311.17487},
archivePrefix={arXiv},
primaryClass={cs.CL}
}Taiwan LLM v2 是与 Ubitus K.K. 合作开展的项目。Ubitus 为该项目提供了宝贵的计算资源。