inference: false
license: llama2
language:
- ja
- en
Model Card for Model ID
Original model 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 library to use this model.
Other Quantized Model
New!
dahara1/ELYZA-japanese-Llama-2-7b-instruct-AWQ is newly published.
The awq model has improved ability to follow instructions, so please try it.
There are another two 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
(2)opparco's gguf version
Japanese automated benchmark result
Benchmark settings are the same as 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
elyza_tasks_100_over_4score_prompt borrows data from ELYZA-tasks-100 評価結果シート.
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:
@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},
}
@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