Spaces:
Configuration error
Configuration error
Commit
·
96fcbcc
1
Parent(s):
dd62f9f
Upload README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
---
|
| 3 |
+
# For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
|
| 4 |
+
# Doc / guide: https://huggingface.co/docs/hub/model-cards
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
language:
|
| 7 |
+
- zh
|
| 8 |
+
widget:
|
| 9 |
+
- text: >-
|
| 10 |
+
A chat between a curious user and an artificial intelligence assistant.
|
| 11 |
+
The assistant gives helpful, detailed, and polite answers to the user's
|
| 12 |
+
questions. USER: 你好,請問你可以幫我寫一封推薦信嗎? ASSISTANT:
|
| 13 |
+
library_name: transformers
|
| 14 |
+
pipeline_tag: text-generation
|
| 15 |
+
extra_gated_heading: Acknowledge license to accept the repository.
|
| 16 |
+
extra_gated_prompt: Please contact the author for access.
|
| 17 |
+
extra_gated_button_content: Acknowledge license 同意以上內容
|
| 18 |
+
extra_gated_fields:
|
| 19 |
+
Name: text
|
| 20 |
+
Mail: text
|
| 21 |
+
Organization: text
|
| 22 |
+
Country: text
|
| 23 |
+
Any utilization of the Taiwan LLM repository mandates the explicit acknowledgment and attribution to the original author: checkbox
|
| 24 |
+
使用Taiwan LLM必須明確地承認和歸功於優必達株式會社 Ubitus 以及原始作者: checkbox
|
| 25 |
+
---
|
| 26 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/5df9c78eda6d0311fd3d541f/CmusIT5OlSXvFrbTJ7l-C.png" alt="Taiwan LLM Logo" width="800" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
|
| 27 |
+
|
| 28 |
+
# 🌟 Checkout [Taiwan-LLM Demo Chat-UI](http://www.twllm.com) 🌟
|
| 29 |
+
|
| 30 |
+
# Model Card for Taiwan LLM 7B v2.1 chat
|
| 31 |
+
|
| 32 |
+
Taiwan LLM is an advanced language model tailored for Traditional Chinese, focusing on the linguistic and cultural contexts of Taiwan.
|
| 33 |
+
Developed from a large base model, it's enriched with diverse Taiwanese textual sources and refined through Supervised Fine-Tuning.
|
| 34 |
+
This model excels in language understanding and generation, aligning closely with Taiwan's cultural nuances.
|
| 35 |
+
It demonstrates improved performance on various benchmarks like TC-Eval, showcasing its contextual comprehension and cultural relevance.
|
| 36 |
+
For detailed insights into Taiwan LLM's development and features, refer to our [technical report](https://github.com/MiuLab/Taiwan-LLaMa/blob/main/twllm_paper.pdf).
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
## Model description
|
| 40 |
+
|
| 41 |
+
- **Model type:** A 7B parameter GPT-like model fine-tuned on a mix of publicly available, synthetic datasets.
|
| 42 |
+
- **Language(s) (NLP):** Primarily Traditional Chinese (zh-tw)
|
| 43 |
+
- **Finetuned from model:** [yentinglin/Taiwan-LLM-7B-v2.0-base](https://huggingface.co/yentinglin/yentinglin/Taiwan-LLM-7B-v2.0-base)
|
| 44 |
+
|
| 45 |
+
### Model Sources
|
| 46 |
+
|
| 47 |
+
<!-- Provide the basic links for the model. -->
|
| 48 |
+
|
| 49 |
+
- **Repository:** https://github.com/MiuLab/Taiwan-LLaMa
|
| 50 |
+
- **Demo:** https://twllm.com/
|
| 51 |
+
|
| 52 |
+
## Performance
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+

|
| 56 |
+
|
| 57 |
+
## Intended uses
|
| 58 |
+
|
| 59 |
+
Here's how you can run the model using the `pipeline()` function from 🤗 Transformers:
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
# pip install transformers>=4.34
|
| 63 |
+
# pip install accelerate
|
| 64 |
+
|
| 65 |
+
import torch
|
| 66 |
+
from transformers import pipeline
|
| 67 |
+
|
| 68 |
+
pipe = pipeline("text-generation", model="yentinglin/Taiwan-LLM-7B-v2.1-chat", torch_dtype=torch.bfloat16, device_map="auto")
|
| 69 |
+
|
| 70 |
+
# We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
|
| 71 |
+
messages = [
|
| 72 |
+
{
|
| 73 |
+
"role": "system",
|
| 74 |
+
"content": "你是一個人工智慧助理",
|
| 75 |
+
},
|
| 76 |
+
{"role": "user", "content": "東北季風如何影響台灣氣候?"},
|
| 77 |
+
]
|
| 78 |
+
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 79 |
+
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
| 80 |
+
print(outputs[0]["generated_text"])
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
### Training hyperparameters
|
| 84 |
+
|
| 85 |
+

|
| 86 |
+
|
| 87 |
+

|
| 88 |
+
|
| 89 |
+
|
| 90 |
+

|
| 91 |
+
|
| 92 |
+
The following hyperparameters were used during training:
|
| 93 |
+
- learning_rate: 5e-05
|
| 94 |
+
- distributed_type: multi-GPU
|
| 95 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
| 96 |
+
- lr_scheduler_type: cosine
|
| 97 |
+
- lr_scheduler_warmup_ratio: 0.03
|
| 98 |
+
- num_epochs: 5.0
|
| 99 |
+
|
| 100 |
+
## Citation
|
| 101 |
+
|
| 102 |
+
If you find Taiwan LLM is useful in your work, please cite it with:
|
| 103 |
+
|
| 104 |
+
```
|
| 105 |
+
@misc{lin2023taiwan,
|
| 106 |
+
title={Taiwan LLM: Bridging the Linguistic Divide with a Culturally Aligned Language Model},
|
| 107 |
+
author={Yen-Ting Lin and Yun-Nung Chen},
|
| 108 |
+
year={2023},
|
| 109 |
+
eprint={2311.17487},
|
| 110 |
+
archivePrefix={arXiv},
|
| 111 |
+
primaryClass={cs.CL}
|
| 112 |
+
}
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
# Acknowledgement
|
| 116 |
+
|
| 117 |
+
Taiwan LLM v2 is conducted in collaboration with [Ubitus K.K.](http://ubitus.net). Ubitus provides valuable compute resources for the project.
|