Update README.md
Browse files
README.md
CHANGED
@@ -5,6 +5,7 @@ language:
|
|
5 |
- en
|
6 |
pipeline_tag: text-generation
|
7 |
---
|
|
|
8 |
# GGUF: Breeze-7B-Instruct-v1_0
|
9 |
|
10 |
Use [llama.cpp](https://github.com/ggerganov/llama.cpp) to convert [Breeze-7B-Instruct-v1_0](https://huggingface.co/MediaTek-Research/Breeze-7B-Instruct-v1_0) into 3 gguf models.
|
@@ -31,3 +32,61 @@ Use [llama.cpp](https://github.com/ggerganov/llama.cpp) to convert [Breeze-7B-In
|
|
31 |
4. Choose the right model/preset and start conversation
|
32 |
|
33 |
![](misc/lmstudio_3.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
- en
|
6 |
pipeline_tag: text-generation
|
7 |
---
|
8 |
+
|
9 |
# GGUF: Breeze-7B-Instruct-v1_0
|
10 |
|
11 |
Use [llama.cpp](https://github.com/ggerganov/llama.cpp) to convert [Breeze-7B-Instruct-v1_0](https://huggingface.co/MediaTek-Research/Breeze-7B-Instruct-v1_0) into 3 gguf models.
|
|
|
32 |
4. Choose the right model/preset and start conversation
|
33 |
|
34 |
![](misc/lmstudio_3.png)
|
35 |
+
|
36 |
+
## How to locally use those models by Python codes
|
37 |
+
|
38 |
+
1. Install [ctransformers](https://github.com/marella/ctransformers)
|
39 |
+
|
40 |
+
Run one of the following commands, according to your system:
|
41 |
+
|
42 |
+
```
|
43 |
+
# Base ctransformers with no GPU acceleration
|
44 |
+
pip install ctransformers
|
45 |
+
# Or with CUDA GPU acceleration
|
46 |
+
pip install ctransformers[cuda]
|
47 |
+
# Or with AMD ROCm GPU acceleration (Linux only)
|
48 |
+
CT_HIPBLAS=1 pip install ctransformers --no-binary ctransformers
|
49 |
+
# Or with Metal GPU acceleration for macOS systems only
|
50 |
+
CT_METAL=1 pip install ctransformers --no-binary ctransformers
|
51 |
+
```
|
52 |
+
|
53 |
+
2. Simple code
|
54 |
+
|
55 |
+
```python
|
56 |
+
from ctransformers import AutoModelForCausalLM
|
57 |
+
|
58 |
+
# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
|
59 |
+
llm = AutoModelForCausalLM.from_pretrained(
|
60 |
+
"YC-Chen/Breeze-7B-Instruct-v1_0-GGUF",
|
61 |
+
model_file="breeze-7b-instruct-v1_0-q6_k.gguf",
|
62 |
+
model_type="mistral",
|
63 |
+
context_length=8000,
|
64 |
+
gpu_layers=50)
|
65 |
+
|
66 |
+
from transformers import AutoTokenizer
|
67 |
+
tokenizer = AutoTokenizer.from_pretrained("MediaTek-Research/Breeze-7B-Instruct-v1_0")
|
68 |
+
|
69 |
+
gen_kwargs = dict(
|
70 |
+
max_new_tokens=1024,
|
71 |
+
repetition_penalty=1.1,
|
72 |
+
stop=["[INST]"],
|
73 |
+
temperature=0.0,
|
74 |
+
top_p=0.0,
|
75 |
+
top_k=1,
|
76 |
+
)
|
77 |
+
|
78 |
+
chat = [
|
79 |
+
{"role": "system", "content": "You are a helpful AI assistant built by MediaTek Research. The user you are helping speaks Traditional Chinese and comes from Taiwan."},
|
80 |
+
{"role": "user", "content": "請介紹五樣台灣小吃"}
|
81 |
+
]
|
82 |
+
for text in llm(tokenizer.apply_chat_template(chat, tokenize=False), stream=True, **gen_kwargs):
|
83 |
+
print(text, end="", flush=True)
|
84 |
+
|
85 |
+
# 以下推薦五樣台灣的小吃:
|
86 |
+
#
|
87 |
+
# 1. 蚵仔煎 (Oyster omelette) - 蚵仔煎是一種以蛋、麵皮和蚵仔為主要食材的傳統美食。它通常在油鍋中煎至金黃色,外酥內嫩,並帶有一股獨特的香氣。蚵仔煎是一道非常受歡迎的小吃,經常可以在夜市或小吃店找到。
|
88 |
+
# 2. 牛肉麵 (Beef noodle soup) - 牛肉麵是台灣的經典美食之一,它以軟嫩的牛肉和濃郁的湯頭聞名。不同地區的牛肉麵可能有不同的口味和配料,但通常都會包含麵條、牛肉、蔬菜和調味料。牛肉麵在全台灣都有不少知名店家,例如林東芳牛肉麵、牛大哥牛肉麵等。
|
89 |
+
# 3. 鹹酥雞 (Fried chicken) - 鹹酥雞是一種以雞肉為主要食材的快餐。它通常會經過油炸處理,然後搭配多種蔬菜和調味料。鹹酥雞的口味因地區而異,但通常都會有辣、甜、鹹等不同風味。鹹酥雞經常可以在夜市或路邊攤找到,例如鼎王鹹酥雞、鹹酥G去等知名店家。
|
90 |
+
# 4. 珍珠奶茶 (Bubble tea) - 珍珠奶茶是一種以紅茶為基底的飲品,加入珍珠(Q彈的小湯圓)和鮮奶。它起源於台灣,並迅速成為全球流行的飲料。珍珠奶茶在全台灣都有不少知名品牌,例如茶湯會、五桐號等。
|
91 |
+
# 5. 臭豆腐 (Stinky tofu) - 臭豆腐是一種以發酵豆腐為原料製作的傳統小吃。它具有強烈的氣味,但味道獨特且深受台灣人喜愛。臭豆腐通常會搭配多種調味料和配料,例如辣椒醬、蒜泥、酸菜等。臭豆腐在全台灣都有不少知名店家,例如阿宗麵線、大勇街臭豆腐等。
|
92 |
+
```
|