Model Card for Model ID
Original model elyza/ELYZA-japanese-Llama-2-7b-instruct which is based on Meta's "Llama 2" and has undergone additional pre-training in Japanese instruction.
This model is a AWQ quantized(miniaturized to 3.89GB) version of the original model(13.48GB).
Model Details
Currently, this model is confirmed to work with Colab A100 or RTX 3000 Series on local PC.
This is because autoAWQ uses NVIDIA's PTX assembly instructions, some of which are only supported on sm80 and higher architectu.
Free Colab(T4) is sm75 and Colab Pro(V100) is sm70.
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.
But this model has better ability to follow instructions than the previous GPTQ version.
Sample Script
Colab
AWQ version Colab sample A100 only
local PC
install Library.
pip install autoawq
script example.
from awq import AutoAWQForCausalLM
from transformers import AutoTokenizer
quant_path = 'dahara1/ELYZA-japanese-Llama-2-7b-instruct-AWQ'
quant_config = { "zero_point": True, "q_group_size": 128, "w_bit": 4 }
quantized_model_dir = "ELYZA-japanese-Llama-2-7b-instruct-AWQ"
quant_file = "awq_model_w4_g128.pt"
model = AutoAWQForCausalLM.from_quantized(quantized_model_dir, quant_file)
tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir, trust_remote_code=True)
B_INST, E_INST = "[INST]", "[/INST]"
B_SYS, E_SYS = "<<SYS>>\n", "\n<</SYS>>\n\n"
DEFAULT_SYSTEM_PROMPT = "あなたは誠実で優秀な日本人のアシスタントです。"
elyza_tasks_100_over_4score_prompt = [
"""リラックマが船橋市に行ってふなっしーと強敵(トモ)になり、最終的にはトー横に住みつくというプロットの短編小説を劇画風文体で書いてみてください。""",
]
for i in range(len(elyza_tasks_100_over_4score_prompt)):
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=elyza_tasks_100_over_4score_prompt[i],
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]))
Output
<s><s> [INST] <<SYS>>
あなたは誠実で優秀な日本人のアシスタントです。
<</SYS>>
リラックマが船橋市に行ってふなっしーと強敵(トモ)になり、最終的にはトー横に住みつくというプロットの短編小説を劇画風文体で書いてみてください。 [/INST] リラックマが船橋市にやってきた。
彼はふなっしーと強敵(トモ)になるために、船橋競艇場へと向かった。
ふなっしーはリラックマの登場に驚いたが、すぐに強気のレースを展開した。
リラックマはその走りに感化され、自身も熱くなっていく。
ふなっしーは最終周回で逆転を狙うが、リラックマはそれをかわして優勝を飾った。
ふなっしーは敗北を喫しながらも、リラックマの強さを認める。
ふなっしーはリラックマに船橋を後にするよ
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}
}
@article{lin2023awq,
title={AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration},
author={Lin, Ji and Tang, Jiaming and Tang, Haotian and Yang, Shang and Dang, Xingyu and Han, Song},
journal={arXiv},
year={2023}
}
about this work
- This Quantization work was done by : webbigdata
See also
AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration
mit-han-lab/llm-awq
casper-hansen/AutoAWQ
- Downloads last month
- 39