Views
No views yet
| Name | Quant method | Bits | Size | Use case |
|---|---|---|---|---|
| llama-3-taiwan-8b-instruct-q5_0.gguf | Q5_0 | 5 | 5.6 GB | legacy; medium, balanced quality |
| llama-3-taiwan-8b-instruct-q5_1.gguf | Q5_1 | 5 | 6.07 GB | large, low quality loss |
| llama-3-taiwan-8b-instruct-q5_k_s.gguf | Q5_K_S | 5 | 5.6 GB | large, very low quality loss |
| llama-3-taiwan-8b-instruct-q5_k_m.gguf | Q5_K_M | 5 | 5.73 GB | large, very low quality loss |
| llama-3-taiwan-8b-instruct-q6_k.gguf | Q6_K | 6 | 6.6 GB | very large, extremely low quality loss |
| llama-3-taiwan-8b-instruct-q8_0.gguf | Q8_0 | 8 | 8.54 GB | very large, extremely low quality loss |

mtkresearch/TCEval with bug fixing
Search Web on twllm.com

json mode.INTRODUCTION TO GENERATIVE AI 2024 SPRING from HUNG-YI LEE (李宏毅)
1import torch
2from transformers import pipeline, StoppingCriteria
3
4# Define a custom stopping criteria class
5class EosListStoppingCriteria(StoppingCriteria):
6 def __init__(self, eos_sequence=[128256]):
7 self.eos_sequence = eos_sequence
8
9 def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs) -> bool:
10 last_ids = input_ids[:, -len(self.eos_sequence):].tolist()
11 return self.eos_sequence in last_ids
12
13# Initialize the model with automatic device mapping
14llm = pipeline("text-generation", model="yentinglin/Llama-3-Taiwan-70B-Instruct-rc1", device_map="auto")
15tokenizer = llm.tokenizer
16
17# Define a conversation example
18chat = [
19 {"role": "system", "content": "You are an AI assistant called Twllm, created by TAME (TAiwan Mixture of Expert) project."},
20 {"role": "user", "content": "你好,請問你可以完成什麼任務?"},
21 {"role": "assistant", "content": "你好,我可以幫助您解決各種問題、提供資訊並協助完成多種任務。例如:回答技術問題、提供建議、翻譯文字、尋找資料或協助您安排行程等。請告訴我如何能幫助您。"},
22 {"role": "user", "content": "太棒了!"}
23]
24flatten_chat_for_generation = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
25"""
26<|im_start|>user
27You are an AI assistant called Twllm, created by TAME (TAiwan Mixture of Expert) project.<|im_end|>
28<|im_start|>user
29你好,請問你可以完成什麼任務?<|im_end|>
30<|im_start|>assistant
31你好,我可以幫助您解決各種問題、提供資訊和協助您完成許多不同的任務。例如:回答技術問題、提供建議、翻譯文字、尋找資料或協助您安排行程等。請告訴我如何能幫助您。<|im_end|>
32<|im_start|>user
33太棒了!<|im_end|>
34<|im_start|>assistant
35
36"""
37
38# Generate a response using the custom stopping criteria
39output = llm(flatten_chat_for_generation, return_full_text=False, max_new_tokens=128, top_p=0.9, temperature=0.7, stopping_criteria=[EosListStoppingCriteria([tokenizer.eos_token_id])])
40print(output[0]['generated_text'])
41"謝謝!很高興能夠為您服務。如果有任何其他需要協助的地方,請隨時與我聯繫。我會盡最大努力為您提供所需的支援。"1export NUM_GPUS=4
2export PORT=8000
3
4docker run \
5 -e HF_TOKEN=$HF_TOKEN \
6 --gpus '"device=0,1,2,3"' \
7 -v ~/.cache/huggingface:/root/.cache/huggingface \
8 -p "${PORT}:8000" \
9 --ipc=host \
10 vllm/vllm-openai:v0.4.0.post1 \
11 --model "yentinglin/Llama-3-Taiwan-70B-Instruct-rc1" \
12 -tp "${NUM_GPUS}"1# pip install "openai>=1.0.0"
2from openai import OpenAI
3# Set OpenAI's API key and API base to use vLLM's API server.
4openai_api_key = "EMPTY"
5openai_api_base = "http://localhost:8000/v1"
6
7client = OpenAI(
8 api_key=openai_api_key,
9 base_url=openai_api_base,
10)
11
12chat_response = client.chat.completions.create(
13 model="yentinglin/Llama-3-Taiwan-70B-Instruct-rc1",
14 messages=[
15 {"role": "system", "content": "You are a helpful assistant."},
16 {"role": "user", "content": "Tell me a joke."},
17 ]
18)
19print("Chat response:", chat_response)@article{DBLP:journals/corr/abs-2311-17487,
author = {Yen{-}Ting Lin and
Yun{-}Nung Chen},
title = {Taiwan {LLM:} Bridging the Linguistic Divide with a Culturally Aligned
Language Model},
journal = {CoRR},
volume = {abs/2311.17487},
year = {2023},
url = {https://doi.org/10.48550/arXiv.2311.17487},
doi = {10.48550/ARXIV.2311.17487},
eprinttype = {arXiv},
eprint = {2311.17487},
timestamp = {Tue, 05 Dec 2023 14:40:42 +0100},
biburl = {https://dblp.org/rec/journals/corr/abs-2311-17487.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
@article{DBLP:journals/corr/abs-2403-20180,
author = {Po{-}Heng Chen and
Sijia Cheng and
Wei{-}Lin Chen and
Yen{-}Ting Lin and
Yun{-}Nung Chen},
title = {Measuring Taiwanese Mandarin Language Understanding},
journal = {CoRR},
volume = {abs/2403.20180},
year = {2024},
url = {https://doi.org/10.48550/arXiv.2403.20180},
doi = {10.48550/ARXIV.2403.20180},
eprinttype = {arXiv},
eprint = {2403.20180},
timestamp = {Wed, 10 Apr 2024 17:37:45 +0200},
biburl = {https://dblp.org/rec/journals/corr/abs-2403-20180.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}