munish0838
commited on
Commit
•
a4ea241
1
Parent(s):
40699a1
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: transformers
|
3 |
+
license: llama3
|
4 |
+
language:
|
5 |
+
- ja
|
6 |
+
- en
|
7 |
+
base_model: elyza/Llama-3-ELYZA-JP-8B
|
8 |
+
pipeline_tag: text-generation
|
9 |
+
---
|
10 |
+
## Llama-3-ELYZA-JP-8B- GGUF
|
11 |
+
This is quantized version of [elyza/Llama-3-ELYZA-JP-8B](https://huggingface.co/elyza/Llama-3-ELYZA-JP-8B) created using llama.cpp
|
12 |
+
|
13 |
+
### Model Description
|
14 |
+
|
15 |
+
![Llama-3-ELYZA-JP-8B-image](./key_visual.png)
|
16 |
+
|
17 |
+
|
18 |
+
**Llama-3-ELYZA-JP-8B** is a large language model trained by [ELYZA, Inc](https://elyza.ai/).
|
19 |
+
Based on [meta-llama/Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct), it has been enhanced for Japanese usage through additional pre-training and instruction tuning. (Built with Meta Llama3)
|
20 |
+
|
21 |
+
For more details, please refer to [our blog post](https://note.com/elyza/n/n360b6084fdbd).
|
22 |
+
|
23 |
+
### Usage
|
24 |
+
|
25 |
+
```python
|
26 |
+
import torch
|
27 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
28 |
+
|
29 |
+
DEFAULT_SYSTEM_PROMPT = "あなたは誠実で優秀な日本人のアシスタントです。特に指示が無い場合は、常に日本語で回答してください。"
|
30 |
+
text = "仕事の熱意を取り戻すためのアイデアを5つ挙げてください。"
|
31 |
+
|
32 |
+
model_name = "elyza/Llama-3-ELYZA-JP-8B"
|
33 |
+
|
34 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
35 |
+
model = AutoModelForCausalLM.from_pretrained(
|
36 |
+
model_name,
|
37 |
+
torch_dtype="auto",
|
38 |
+
device_map="auto",
|
39 |
+
)
|
40 |
+
model.eval()
|
41 |
+
|
42 |
+
messages = [
|
43 |
+
{"role": "system", "content": DEFAULT_SYSTEM_PROMPT},
|
44 |
+
{"role": "user", "content": text},
|
45 |
+
]
|
46 |
+
prompt = tokenizer.apply_chat_template(
|
47 |
+
messages,
|
48 |
+
tokenize=False,
|
49 |
+
add_generation_prompt=True
|
50 |
+
)
|
51 |
+
token_ids = tokenizer.encode(
|
52 |
+
prompt, add_special_tokens=False, return_tensors="pt"
|
53 |
+
)
|
54 |
+
|
55 |
+
with torch.no_grad():
|
56 |
+
output_ids = model.generate(
|
57 |
+
token_ids.to(model.device),
|
58 |
+
max_new_tokens=1200,
|
59 |
+
do_sample=True,
|
60 |
+
temperature=0.6,
|
61 |
+
top_p=0.9,
|
62 |
+
)
|
63 |
+
output = tokenizer.decode(
|
64 |
+
output_ids.tolist()[0][token_ids.size(1):], skip_special_tokens=True
|
65 |
+
)
|
66 |
+
print(output)
|
67 |
+
```
|
68 |
+
|
69 |
+
### Developers
|
70 |
+
|
71 |
+
Listed in alphabetical order.
|
72 |
+
|
73 |
+
- [Masato Hirakawa](https://huggingface.co/m-hirakawa)
|
74 |
+
- [Shintaro Horie](https://huggingface.co/e-mon)
|
75 |
+
- [Tomoaki Nakamura](https://huggingface.co/tyoyo)
|
76 |
+
- [Daisuke Oba](https://huggingface.co/daisuk30ba)
|
77 |
+
- [Sam Passaglia](https://huggingface.co/passaglia)
|
78 |
+
- [Akira Sasaki](https://huggingface.co/akirasasaki)
|
79 |
+
|
80 |
+
### License
|
81 |
+
|
82 |
+
[Meta Llama 3 Community License](https://llama.meta.com/llama3/license/)
|
83 |
+
|
84 |
+
### How to Cite Original Model
|
85 |
+
|
86 |
+
```tex
|
87 |
+
@misc{elyzallama2024,
|
88 |
+
title={elyza/Llama-3-ELYZA-JP-8B},
|
89 |
+
url={https://huggingface.co/elyza/Llama-3-ELYZA-JP-8B},
|
90 |
+
author={Masato Hirakawa and Shintaro Horie and Tomoaki Nakamura and Daisuke Oba and Sam Passaglia and Akira Sasaki},
|
91 |
+
year={2024},
|
92 |
+
}
|
93 |
+
```
|
94 |
+
|
95 |
+
### Model Citations
|
96 |
+
|
97 |
+
```tex
|
98 |
+
@article{llama3modelcard,
|
99 |
+
title={Llama 3 Model Card},
|
100 |
+
author={AI@Meta},
|
101 |
+
year={2024},
|
102 |
+
url = {https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md}
|
103 |
+
}
|
104 |
+
```
|