botp/yentinglin-zh_TW_c4
Language Models for Taiwanese Culture ✍️ Online Demo • 🤗 HF Repo • 🐦 Twitter • 📃 [Paper Coming Soon] • 👨️ Yen-Ting Lin Overview Taiwan-LLaMa is a full parameter fine-tuned model based on LLaMa 2 for Traditional Mandarin applications. Taiwan-LLaMa v1.0 pretrained on over 5 billion tokens and instruction-tuned on over 490k conversations both in traditional mandarin. Demo A live demonstration of… See the full description on the dataset page: https://huggingface.co/datasets/botp/yentinglin-zh_TW_c4.
Language Models for Taiwanese Culture
<p align="center"> ✍️ <a href="https://huggingface.co/spaces/yentinglin/Taiwan-LLaMa2" target="blank">Online Demo</a> • 🤗 <a href="https://huggingface.co/yentinglin" target="blank">HF Repo</a> • 🐦 <a href="https://twitter.com/yentinglin56" target="blank">Twitter</a> • 📃 <a href="https://arxiv.org/pdf/2305.13711.pdf" target="blank">[Paper Coming Soon]</a> • 👨️ <a href="https://yentingl.com/" target="blank">Yen-Ting Lin</a> <br/><br/> <img src="https://www.csie.ntu.edu.tw/~miulab/taiwan-llama/logo-v2.png" width="100"> <br/> <a href="https://github.com/tatsu-lab/stanfordalpaca/blob/main/LICENSE"> <img src="https://img.shields.io/badge/Code%20License-Apache2.0-green.svg"></a> <a href="https://github.com/tatsu-lab/stanfordalpaca/blob/main/DATA_LICENSE"> <img src="https://img.shields.io/badge/Data%20License-CC%20By%20NC%204.0-red.svg"></a> <br/>
</p>
Overview
Taiwan-LLaMa is a full parameter fine-tuned model based on LLaMa 2 for Traditional Mandarin applications.
Taiwan-LLaMa v1.0 pretrained on over 5 billion tokens and instruction-tuned on over 490k conversations both in traditional mandarin.
Demo
A live demonstration of the model can be accessed at Hugging Face Spaces.
Key Features
- Traditional Mandarin Support: The model is fine-tuned to understand and generate text in Traditional Mandarin, making it suitable for Taiwanese culture and related applications.
- Instruction-Tuned: Further fine-tuned on conversational data to offer context-aware and instruction-following responses.
- Performance on Vicuna Benchmark: Taiwan-LLaMa's relative performance on Vicuna Benchmark is measured against models like GPT-4 and ChatGPT. It's particularly optimized for Taiwanese culture.
- Flexible Customization: Advanced options for controlling the model's behavior like system prompt, temperature, top-p, and top-k are available in the demo.
Work in progress
- [ ] Improved pretraining: A refined pretraining process (e.g. more data from Taiwan, training strategies) is under development, aiming to enhance model performance for better Taiwanese culture.
- [ ] Extend max length: Utilizing the Rope mechanism as described in the paper, the model's length will be extended from 4k to 8k.
Taiwanese Culture Examples
Model
We provide a number of model checkpoints that we trained. Please find them on Hugging Face here. Here are some quick links to the checkpoints that are finetuned from LLaMa 2:
Data
Here are some quick links to the datasets that we used to train the models:
Architecture
Taiwan-LLaMa is based on LLaMa 2, leveraging transformer architecture, <a href="https://github.com/Dao-AILab/flash-attention" target="_blank">flash attention 2</a>, and bfloat16.
It includes:
- Pretraining Phase: Pretrained on a vast corpus of over 5 billion tokens, extracted from common crawl in Traditional Mandarin.
- Fine-tuning Phase: Further instruction-tuned on over 490k multi-turn conversational data to enable more instruction-following and context-aware responses.
Generic Capabilities on Vicuna Benchmark
The data is translated into traditional mandarin for evaluating the general capability.
<img src="./images/zhtwvicunabench_chatgptbaseline.png" width="700">
The scores are calculated with ChatGPT as the baseline, represented as 100%. The other values show the relative performance of different models compared to ChatGPT.
How to deploy the model on my own machine?
We recommend hosting models with 🤗 Text Generation Inference. Please see their license for details on usage and limitations.
bash run_text_generation_inference.sh "yentinglin/Taiwan-LLaMa" NUM_GPUS DIR_TO_SAVE_MODEL PORT MAX_INPUT_LEN MODEL_MAX_LENPrompt format follows vicuna-v1.1 template:
A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: {user} ASSISTANT:Setup development environment
conda create -n taiwan-llama python=3.10 -y
conda activate taiwan-llama
pip install -r requirements.txtCitations
If you use our code, data, or models in your research, please cite this repository. You can use the following BibTeX entry:
@inproceedings{lin-chen-2023-llm,
title = "{LLM}-Eval: Unified Multi-Dimensional Automatic Evaluation for Open-Domain Conversations with Large Language Models",
author = "Lin, Yen-Ting and Chen, Yun-Nung",
booktitle = "Proceedings of the 5th Workshop on NLP for Conversational AI (NLP4ConvAI 2023)",
month = jul,
year = "2023",
address = "Toronto, Canada",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2023.nlp4convai-1.5",
pages = "47--58"
}
@misc{taiwanllama,
author={Lin, Yen-Ting and Chen, Yun-Nung},
title={Taiwanese-Aligned Language Models based on Meta-Llama2},
year={2023},
url={https://github.com/adamlin120/Taiwan-LLaMa},
note={Code and models available at https://github.com/adamlin120/Taiwan-LLaMa},
}Collaborate With Us
If you are interested in contributing to the development of Traditional Mandarin language models, exploring new applications, or leveraging Taiwan-LLaMa for your specific needs, please don't hesitate to contact us. We welcome collaborations from academia, industry, and individual contributors.
License
The code in this project is licensed under the Apache 2.0 License - see the LICENSE file for details.
The models included in this project are licensed under the LLAMA 2 Community License. See the LLAMA2 License for full details.
OpenAI Data Acknowledgment
The data included in this project were generated using OpenAI's models and are subject to OpenAI's Terms of Use. Please review OpenAI's Terms of Use for details on usage and limitations.
Acknowledgements
We thank Meta LLaMA team and Vicuna team for their open-source efforts in democratizing large language models.
