Update README.md
Browse files
README.md
CHANGED
@@ -1 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Llama-3-ELYZA-JP-8B-AWQ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: transformers
|
3 |
+
license: llama3
|
4 |
+
language:
|
5 |
+
- ja
|
6 |
+
- en
|
7 |
+
---
|
8 |
+
|
9 |
# Llama-3-ELYZA-JP-8B-AWQ
|
10 |
+
|
11 |
+
![Llama-3-ELYZA-JP-8B-image](./key_visual.png)
|
12 |
+
|
13 |
+
## Model Description
|
14 |
+
|
15 |
+
**Llama-3-ELYZA-JP-8B** is a large language model trained by [ELYZA, Inc](https://elyza.ai/).
|
16 |
+
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.
|
17 |
+
|
18 |
+
For more details, please refer to [our blog post](https://note.com/elyza/n/n360b6084fdbd).
|
19 |
+
|
20 |
+
## AWQ Quantization
|
21 |
+
|
22 |
+
This model is quantized using the [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
|
23 |
+
|
24 |
+
## Use with vLLM
|
25 |
+
|
26 |
+
Install vLLM.
|
27 |
+
|
28 |
+
```bash
|
29 |
+
pip install vllm
|
30 |
+
```
|
31 |
+
|
32 |
+
### vLLM Offline Batched Inference
|
33 |
+
|
34 |
+
```python
|
35 |
+
from vllm import LLM, SamplingParams
|
36 |
+
|
37 |
+
llm = LLM(model="elyza/Llama-3-ELYZA-JP-8B-AWQ", quantization="awq")
|
38 |
+
tokenizer = llm.get_tokenizer()
|
39 |
+
|
40 |
+
DEFAULT_SYSTEM_PROMPT = "あなたは誠実で優秀な日本人のアシスタントです。特に指示が無い場合は、常に日本語で回答してください。"
|
41 |
+
sampling_params = SamplingParams(temperature=0.6, top_p=0.9, max_tokens=1000)
|
42 |
+
messages_batch = [
|
43 |
+
[
|
44 |
+
{"role": "system", "content": DEFAULT_SYSTEM_PROMPT},
|
45 |
+
{"role": "user", "content": "古代ギリシャを学ぶ上で知っておくべきポイントは?"}
|
46 |
+
],
|
47 |
+
[
|
48 |
+
{"role": "system", "content": DEFAULT_SYSTEM_PROMPT},
|
49 |
+
{"role": "user", "content": "クマが海辺に行ってアザラシと友達になり、最終的には家に帰るというプロットの短編小説を書いてください。"}
|
50 |
+
]
|
51 |
+
]
|
52 |
+
|
53 |
+
prompts = [
|
54 |
+
tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
55 |
+
for messages in messages_batch
|
56 |
+
]
|
57 |
+
|
58 |
+
outputs = llm.generate(prompts, sampling_params)
|
59 |
+
|
60 |
+
# Print the outputs.
|
61 |
+
for output in outputs:
|
62 |
+
print(output.outputs[0].text)
|
63 |
+
print("=" * 50)
|
64 |
+
```
|
65 |
+
|
66 |
+
|
67 |
+
### vLLM OpenAI Compatible Server
|
68 |
+
|
69 |
+
Start the API server.
|
70 |
+
|
71 |
+
```bash
|
72 |
+
python -m vllm.entrypoints.openai.api_server \
|
73 |
+
--model elyza/Llama-3-ELYZA-JP-8B-AWQ \
|
74 |
+
--port 8000 \
|
75 |
+
--host localhost \
|
76 |
+
--quantization awq
|
77 |
+
```
|
78 |
+
|
79 |
+
|
80 |
+
Call the API using curl.
|
81 |
+
|
82 |
+
```bash
|
83 |
+
curl http://localhost:8000/v1/chat/completions \
|
84 |
+
-H "Content-Type: application/json" \
|
85 |
+
-d '{
|
86 |
+
"model": "elyza/Llama-3-ELYZA-JP-8B-AWQ",
|
87 |
+
"messages": [
|
88 |
+
{ "role": "system", "content": "あなたは誠実で優秀な日本人のアシスタントです。特に指示が無い場合は、常に日本語で回答してください。" },
|
89 |
+
{ "role": "user", "content": "古代ギリシャを学ぶ上で知っておくべきポイントは?" }
|
90 |
+
],
|
91 |
+
"temperature": 0.6,
|
92 |
+
"max_tokens": 1000,
|
93 |
+
"stream": false
|
94 |
+
}'
|
95 |
+
```
|
96 |
+
|
97 |
+
Call the API using Python.
|
98 |
+
|
99 |
+
```python
|
100 |
+
import openai
|
101 |
+
|
102 |
+
client = openai.OpenAI(
|
103 |
+
base_url="http://localhost:8000/v1",
|
104 |
+
api_key = "dummy_api_key"
|
105 |
+
)
|
106 |
+
|
107 |
+
completion = client.chat.completions.create(
|
108 |
+
model="elyza/Llama-3-ELYZA-JP-8B-AWQ",
|
109 |
+
messages=[
|
110 |
+
{"role": "system", "content": "あなたは誠実で優秀な日本人のアシスタントです。特に指示が無い場合は、常に日本語で回答してください。"},
|
111 |
+
{"role": "user", "content": "古代ギリシャを学ぶ上で知っておくべきポイントは?"}
|
112 |
+
]
|
113 |
+
)
|
114 |
+
```
|
115 |
+
|
116 |
+
## Developers
|
117 |
+
|
118 |
+
Listed in alphabetical order.
|
119 |
+
|
120 |
+
- [Masato Hirakawa](https://huggingface.co/m-hirakawa)
|
121 |
+
- [Shintaro Horie](https://huggingface.co/e-mon)
|
122 |
+
- [Tomoaki Nakamura](https://huggingface.co/tyoyo)
|
123 |
+
- [Daisuke Oba](https://huggingface.co/daisuk30ba)
|
124 |
+
- [Sam Passaglia](https://huggingface.co/passaglia)
|
125 |
+
- [Akira Sasaki](https://huggingface.co/akirasasaki)
|
126 |
+
|
127 |
+
## License
|
128 |
+
|
129 |
+
[Meta Llama 3 Community License](https://llama.meta.com/llama3/license/)
|
130 |
+
|
131 |
+
## How to Cite
|
132 |
+
|
133 |
+
```tex
|
134 |
+
@misc{elyzallama2024,
|
135 |
+
title={elyza/Llama-3-ELYZA-JP-8B},
|
136 |
+
url={https://huggingface.co/elyza/Llama-3-ELYZA-JP-8B},
|
137 |
+
author={Masato Hirakawa and Shintaro Horie and Tomoaki Nakamura and Daisuke Oba and Sam Passaglia and Akira Sasaki},
|
138 |
+
year={2024},
|
139 |
+
}
|
140 |
+
```
|
141 |
+
|
142 |
+
## Citations
|
143 |
+
|
144 |
+
```tex
|
145 |
+
@article{llama3modelcard,
|
146 |
+
title={Llama 3 Model Card},
|
147 |
+
author={AI@Meta},
|
148 |
+
year={2024},
|
149 |
+
url = {https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md}
|
150 |
+
}
|
151 |
+
```
|