ELYZA-japanese-Llama-2-7b
Collection
7b Llama-2 models augmented for Japanese usage
โข
6 items
โข
Updated
โข
4
ELYZA-japanese-Llama-2-7b ใฏใ Llama2ใใใผในใจใใฆๆฅๆฌ่ช่ฝๅใๆกๅผตใใใใใซ่ฟฝๅ ไบๅๅญฆ็ฟใ่กใฃใใขใใซใงใใ ่ฉณ็ดฐใฏ Blog่จไบ ใๅ็ งใใฆใใ ใใใ
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
B_INST, E_INST = "[INST]", "[/INST]"
B_SYS, E_SYS = "<<SYS>>\n", "\n<</SYS>>\n\n"
DEFAULT_SYSTEM_PROMPT = "ใใชใใฏ่ช ๅฎใงๅช็งใชๆฅๆฌไบบใฎใขใทในใฟใณใใงใใ"
text = "ใฏใใๆตท่พบใซ่กใฃใฆใขใถใฉใทใจๅ้ใซใชใใๆ็ต็ใซใฏๅฎถใซๅธฐใใจใใใใญใใใฎ็ญ็ทจๅฐ่ชฌใๆธใใฆใใ ใใใ"
model_name = "elyza/ELYZA-japanese-Llama-2-7b-instruct"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto")
if torch.cuda.is_available():
model = model.to("cuda")
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,
)
with torch.no_grad():
token_ids = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
output_ids = model.generate(
token_ids.to(model.device),
max_new_tokens=256,
pad_token_id=tokenizer.pad_token_id,
eos_token_id=tokenizer.eos_token_id,
)
output = tokenizer.decode(output_ids.tolist()[0][token_ids.size(1) :], skip_special_tokens=True)
print(output)
"""
ๆฟ็ฅใใพใใใไปฅไธใซใฏใใๆตท่พบใซ่กใฃใฆใขใถใฉใทใจๅ้ใซใชใใๆ็ต็ใซใฏๅฎถใซๅธฐใใจใใใใญใใใฎ็ญ็ทจๅฐ่ชฌใ่จ่ฟฐใใพใใ
ใฏใใฏๅฑฑใฎไธญใงใใฃใใใจ็ ใฃใฆใใใ
ใใฎ็ ใใซ่ฝใกใใฏใใฏใๅคขใฎไธญใงๆตท่พบใๆญฉใใฆใใใ
ใใใซใฏใขใถใฉใทใใใใ
ใฏใใฏใขใถใฉใทใซ่ฉฑใใใใใ
ใใใฏใใใใจใฏใใ่จใใจใใขใถใฉใทใฏ้ฉใใใใใซ้กใไธใใใ
ใใใใใใซใกใฏใใขใถใฉใทใฏ็ญใใใ
ใฏใใฏใขใถใฉใทใจๅ้ใซใชใใใใจๆใใ
ใ็งใฏใฏใใจ็ณใใพใใใใฏใใฏ...
"""
Model Name | Vocab Size | #Params |
---|---|---|
elyza/ELYZA-japanese-Llama-2-7b | 32000 | 6.27B |
elyza/ELYZA-japanese-Llama-2-7b-instruct | 32000 | 6.27B |
elyza/ELYZA-japanese-Llama-2-7b-fast | 45043 | 6.37B |
elyza/ELYZA-japanese-Llama-2-7b-fast-instruct | 45043 | 6.37B |
ไปฅไธใขใซใใกใใใ้
Llama 2 is licensed under the LLAMA 2 Community License, Copyright (c) Meta Platforms, Inc. All Rights Reserved.
@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}
}