File size: 7,450 Bytes
bc576be f37b486 bc576be f37b486 bc576be a9c2b61 9b1d0d2 bc576be 9b1d0d2 bc576be 9b1d0d2 bc576be 2e57374 bc576be 2e57374 bc576be 2e57374 bc576be 9b1d0d2 bc576be 9b1d0d2 2e57374 bc576be a9c2b61 bc576be 2e57374 bc576be 9b1d0d2 bc576be 9b1d0d2 bc576be a029d9e bc576be 9b1d0d2 bc576be 9b1d0d2 bc576be a9c2b61 bc576be |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
---
inference: false
license: llama2
language:
- ja
- en
---
# Model Card for Model ID
Original model [elyza/ELYZA-japanese-Llama-2-7b-fast-instruct](https://huggingface.co/elyza/ELYZA-japanese-Llama-2-7b-fast-instruct) which is based on Meta's "Llama 2" and has undergone additional pre-training in Japanese, and thier original post-training and speed up tuning.
This model is a quantized(miniaturized to 4.11GB) version of the original model(13.69GB).
## Model Details
Quantization reduces the amount of memory required and improves execution speed, but unfortunately performance deteriorates.
In particular, the original model is tuned for the purpose of strengthening the ability to follow Japanese instructions, not as a benchmark.
Although the ability to follow instructions cannot be measured using existing automated benchmarks, we have confirmed that quantized model significantly deteriorates the ability to follow instructions.
At least one GPU is currently required due to a limitation of the Accelerate library.
So this model cannot be run with the huggingface space free version.
You need [autoGPTQ](https://github.com/PanQiWei/AutoGPTQ) library to use this model.
## Other Quantized Model
There are two [llama.cpp](https://github.com/ggerganov/llama.cpp) version quantized model.
If you want to run it in a CPU-only environment, you may want to check this.
(1)[mmnga's gguf version](https://huggingface.co/mmnga/ELYZA-japanese-Llama-2-7b-fast-instruct-gguf)
(2)[opparco's gguf version](https://huggingface.co/opparco/ELYZA-japanese-Llama-2-7b-fast-instruct-gguf)
### Japanese automated benchmark result
Benchmark settings are the same as [weblab-10b-instruction-sft-GPTQ](https://huggingface.co/dahara1/weblab-10b-instruction-sft-GPTQ)
| Task |Version| Metric |Value | |Stderr|
|----------------------|------:|--------|-----:|---|-----:|
|jcommonsenseqa-1.1-0.3| 1.1|acc |0.7417|± |0.0131|
| | |acc_norm|0.3485|± |0.0143|
| Task |Version| Metric | Value | |Stderr|
|--------------|------:|-----------|------:|---|------|
|jsquad-1.1-0.3| 1.1|exact_match|69.0455| | |
| | |f1 |80.2155| | |
### Sample Code
```
pip install auto-gptq
```
```
from transformers import AutoTokenizer
from auto_gptq import AutoGPTQForCausalLM
quantized_model_dir = "dahara1/ELYZA-japanese-Llama-2-7b-fast-instruct-GPTQ"
model_basename = "gptq_model-4bit-128g"
tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir)
model = AutoGPTQForCausalLM.from_quantized(
quantized_model_dir,
model_basename=model_basename,
use_safetensors=True,
disable_exllama=False,
inject_fused_attention=False,
device="cuda:0")
B_INST, E_INST = "[INST]", "[/INST]"
B_SYS, E_SYS = "<<SYS>>\n", "\n<</SYS>>\n\n"
DEFAULT_SYSTEM_PROMPT = "あなたは誠実で優秀な日本人のアシスタントです。"
text = "クマが海辺に行ってアザラシと友達になり、最終的には家に帰るというプロットの短編小説を書いてください。"
prompt = "{bos_token}{b_inst} {system}{prompt} {e_inst} ".format(
bos_token=tokenizer.bos_token,
b_inst=B_INST,
system=f"{B_SYS}{DEFAULT_SYSTEM_PROMPT}{E_SYS}",
prompt=text,
e_inst=E_INST,
)
tokens = tokenizer(prompt, return_tensors="pt").to("cuda:0").input_ids
output = model.generate(
input_ids=tokens,
max_new_tokens=256,
pad_token_id=tokenizer.pad_token_id,
eos_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(output[0]))
```
result.
```
<s><s> [INST] <<SYS>>
あなたは誠実で優秀な日本人のアシスタントです。
<</SYS>>
クマが海辺に行ってアザラシと友達になり、最終的には家に帰るというプロットの短編小説を書いてください。 [/INST] クマは海辺にやってきました。
海辺はとてもきれいでした。
クマは海辺に座って、海を眺めていました。
すると、海辺にアザラシがやってきました。
アザラシはクマに話しかけました。
「どうしてここにいるの?」「私は海辺に座って海を眺めていました。
すると、アザラシがやってきました。
アザラシはクマに話しかけました。
「どうしてここにいるの?」「私は海辺に座って海を眺めていました。
すると、アザラシがやってきました。
アザラシはクマに話しかけました。
「どうしてここにいるの?」「私は海辺に座って海を眺めていました。
すると、アザラシがやってきました。
アザラシはクマに話しかけました。
「どうしてここにいるの?」「私は海辺に座って海を眺めていました。
すると、アザラシがやってきました。
アザラシはクマに話しかけました。
「どうしてここに
```
### Colab Sample with extra benchmark
(Colab Sample with extra benchmark)[https://github.com/webbigdata-jp/python_sample/blob/main/ELYZA_japanese_Llama_2_7b_fast_instruct_GPTQ_sample.ipynb]
elyza_tasks_100_over_4score_prompt borrows data from [ELYZA-tasks-100 評価結果シート](https://docs.google.com/spreadsheets/d/1mtoy4QAqDPk2f_B0vDogFoOrbA5G42DBEEHdqM4VmDI/edit#gid=1023787356).
The original model was able to perform well at these prompts but this model does not always give good results.
So if you need high performance, please use the original model.
### 引用 Citations
This model is based on the work of the following people:
```tex
@misc{elyzallama2023,
title={ELYZA-japanese-Llama-2-7b},
url={https://huggingface.co/elyza/ELYZA-japanese-Llama-2-7b},
author={Akira Sasaki and Masato Hirakawa and Shintaro Horie and Tomoaki Nakamura},
year={2023},
}
```
```tex
@misc{touvron2023llama,
title={Llama 2: Open Foundation and Fine-Tuned Chat Models},
author={Hugo Touvron and Louis Martin and Kevin Stone and Peter Albert and Amjad Almahairi and Yasmine Babaei and Nikolay Bashlykov and Soumya Batra and Prajjwal Bhargava and Shruti Bhosale and Dan Bikel and Lukas Blecher and Cristian Canton Ferrer and Moya Chen and Guillem Cucurull and David Esiobu and Jude Fernandes and Jeremy Fu and Wenyin Fu and Brian Fuller and Cynthia Gao and Vedanuj Goswami and Naman Goyal and Anthony Hartshorn and Saghar Hosseini and Rui Hou and Hakan Inan and Marcin Kardas and Viktor Kerkez and Madian Khabsa and Isabel Kloumann and Artem Korenev and Punit Singh Koura and Marie-Anne Lachaux and Thibaut Lavril and Jenya Lee and Diana Liskovich and Yinghai Lu and Yuning Mao and Xavier Martinet and Todor Mihaylov and Pushkar Mishra and Igor Molybog and Yixin Nie and Andrew Poulton and Jeremy Reizenstein and Rashi Rungta and Kalyan Saladi and Alan Schelten and Ruan Silva and Eric Michael Smith and Ranjan Subramanian and Xiaoqing Ellen Tan and Binh Tang and Ross Taylor and Adina Williams and Jian Xiang Kuan and Puxin Xu and Zheng Yan and Iliyan Zarov and Yuchen Zhang and Angela Fan and Melanie Kambadur and Sharan Narang and Aurelien Rodriguez and Robert Stojnic and Sergey Edunov and Thomas Scialom},
year={2023},
eprint={2307.09288},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
```
### about this work
- **This Quantization work was done by :** [webbigdata](https://webbigdata.jp/) |