Update README.md
Browse files
README.md
CHANGED
@@ -1,14 +1,71 @@
|
|
1 |
---
|
2 |
base_model:
|
|
|
3 |
- elyza/Llama-3-ELYZA-JP-8B
|
4 |
- nvidia/Llama3-ChatQA-1.5-8B
|
5 |
library_name: transformers
|
6 |
tags:
|
7 |
- mergekit
|
8 |
- merge
|
9 |
-
|
|
|
10 |
---
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
This is a merge of pre-trained language models created using [mergekit](https://github.com/cg123/mergekit).
|
14 |
|
@@ -20,6 +77,7 @@ This model was merged using the [TIES](https://arxiv.org/abs/2306.01708) merge m
|
|
20 |
### Models Merged
|
21 |
|
22 |
The following models were included in the merge:
|
|
|
23 |
* [elyza/Llama-3-ELYZA-JP-8B](https://huggingface.co/elyza/Llama-3-ELYZA-JP-8B)
|
24 |
* [nvidia/Llama3-ChatQA-1.5-8B](https://huggingface.co/nvidia/Llama3-ChatQA-1.5-8B)
|
25 |
|
@@ -43,4 +101,4 @@ base_model: ./llama3.1-8B
|
|
43 |
parameters:
|
44 |
normalize: false
|
45 |
dtype: bfloat16
|
46 |
-
```
|
|
|
1 |
---
|
2 |
base_model:
|
3 |
+
- meta-llama/Meta-Llama-3.1-8B-Instruct
|
4 |
- elyza/Llama-3-ELYZA-JP-8B
|
5 |
- nvidia/Llama3-ChatQA-1.5-8B
|
6 |
library_name: transformers
|
7 |
tags:
|
8 |
- mergekit
|
9 |
- merge
|
10 |
+
language:
|
11 |
+
- ja
|
12 |
---
|
13 |
+
|
14 |
+
## 概要
|
15 |
+
|
16 |
+
このモデルはllama3.1-8B-instructをもとに日本語性能を高めることを目的にMergekit&ファインチューニングを用いて作成されました。
|
17 |
+
|
18 |
+
meta,ELYZA,nvidiaの皆様に感謝します。
|
19 |
+
|
20 |
+
## how to use
|
21 |
+
|
22 |
+
|
23 |
+
```python
|
24 |
+
import torch
|
25 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
26 |
+
|
27 |
+
DEFAULT_SYSTEM_PROMPT = "あなたは誠実で優秀な日本人のアシスタントです。特に指示が無い場合は、常に日本語で回答してください。"
|
28 |
+
text = "Youtuberとして成功するために大切な5つのことを小学生にでもわかるように教えてください。"
|
29 |
+
|
30 |
+
model_name = "DataPilot/Llama3.1-ArrowSE-v0.4"
|
31 |
+
|
32 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
33 |
+
model = AutoModelForCausalLM.from_pretrained(
|
34 |
+
model_name,
|
35 |
+
torch_dtype="auto",
|
36 |
+
device_map="auto",
|
37 |
+
)
|
38 |
+
model.eval()
|
39 |
+
|
40 |
+
messages = [
|
41 |
+
{"role": "system", "content": DEFAULT_SYSTEM_PROMPT},
|
42 |
+
{"role": "user", "content": text},
|
43 |
+
]
|
44 |
+
prompt = tokenizer.apply_chat_template(
|
45 |
+
messages,
|
46 |
+
tokenize=False,
|
47 |
+
add_generation_prompt=True
|
48 |
+
)
|
49 |
+
token_ids = tokenizer.encode(
|
50 |
+
prompt, add_special_tokens=False, return_tensors="pt"
|
51 |
+
)
|
52 |
+
|
53 |
+
with torch.no_grad():
|
54 |
+
output_ids = model.generate(
|
55 |
+
token_ids.to(model.device),
|
56 |
+
max_new_tokens=1200,
|
57 |
+
do_sample=True,
|
58 |
+
temperature=0.6,
|
59 |
+
top_p=0.9,
|
60 |
+
)
|
61 |
+
output = tokenizer.decode(
|
62 |
+
output_ids.tolist()[0][token_ids.size(1):], skip_special_tokens=True
|
63 |
+
)
|
64 |
+
print(output)
|
65 |
+
```
|
66 |
+
|
67 |
+
|
68 |
+
## merge
|
69 |
|
70 |
This is a merge of pre-trained language models created using [mergekit](https://github.com/cg123/mergekit).
|
71 |
|
|
|
77 |
### Models Merged
|
78 |
|
79 |
The following models were included in the merge:
|
80 |
+
* [meta-llama/Meta-Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct)
|
81 |
* [elyza/Llama-3-ELYZA-JP-8B](https://huggingface.co/elyza/Llama-3-ELYZA-JP-8B)
|
82 |
* [nvidia/Llama3-ChatQA-1.5-8B](https://huggingface.co/nvidia/Llama3-ChatQA-1.5-8B)
|
83 |
|
|
|
101 |
parameters:
|
102 |
normalize: false
|
103 |
dtype: bfloat16
|
104 |
+
```
|