Edit model card

ELYZA-japanese-Llama-2-7b

ELYZA-Japanese-Llama2-image

Model Description

ELYZA-japanese-Llama-2-7b ใฏใ€ Llama2ใ‚’ใƒ™ใƒผใ‚นใจใ—ใฆๆ—ฅๆœฌ่ชž่ƒฝๅŠ›ใ‚’ๆ‹กๅผตใ™ใ‚‹ใŸใ‚ใซ่ฟฝๅŠ ไบ‹ๅ‰ๅญฆ็ฟ’ใ‚’่กŒใฃใŸใƒขใƒ‡ใƒซใงใ™ใ€‚ ่ฉณ็ดฐใฏ Blog่จ˜ไบ‹ ใ‚’ๅ‚็…งใ—ใฆใใ ใ•ใ„ใ€‚

Usage

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)
"""
ๆ‰ฟ็Ÿฅใ—ใพใ—ใŸใ€‚ไปฅไธ‹ใซใ‚ฏใƒžใŒๆตท่พบใซ่กŒใฃใฆใ‚ขใ‚ถใƒฉใ‚ทใจๅ‹้”ใซใชใ‚Šใ€ๆœ€็ต‚็š„ใซใฏๅฎถใซๅธฐใ‚‹ใจใ„ใ†ใƒ—ใƒญใƒƒใƒˆใฎ็Ÿญ็ทจๅฐ่ชฌใ‚’่จ˜่ฟฐใ—ใพใ™ใ€‚

ใ‚ฏใƒžใฏๅฑฑใฎไธญใงใ‚†ใฃใใ‚Šใจ็œ ใฃใฆใ„ใŸใ€‚
ใใฎ็œ ใ‚Šใซ่ฝใกใŸใ‚ฏใƒžใฏใ€ๅคขใฎไธญใงๆตท่พบใ‚’ๆญฉใ„ใฆใ„ใŸใ€‚
ใใ“ใซใฏใ‚ขใ‚ถใƒฉใ‚ทใŒใ„ใŸใ€‚
ใ‚ฏใƒžใฏใ‚ขใ‚ถใƒฉใ‚ทใซ่ฉฑใ—ใ‹ใ‘ใ‚‹ใ€‚

ใ€ŒใŠใฏใ‚ˆใ†ใ€ใจใ‚ฏใƒžใŒ่จ€ใ†ใจใ€ใ‚ขใ‚ถใƒฉใ‚ทใฏ้ฉšใ„ใŸใ‚ˆใ†ใซ้ก”ใ‚’ไธŠใ’ใŸใ€‚
ใ€Œใ‚ใ€ใ“ใ‚“ใซใกใฏใ€ใ‚ขใ‚ถใƒฉใ‚ทใฏ็ญ”ใˆใŸใ€‚
ใ‚ฏใƒžใฏใ‚ขใ‚ถใƒฉใ‚ทใจๅ‹้”ใซใชใ‚ŠใŸใ„ใจๆ€ใ†ใ€‚

ใ€Œ็งใฏใ‚ฏใƒžใจ็”ณใ—ใพใ™ใ€‚ใ€ใ‚ฏใƒžใฏ...
"""

ELYZA-japanese-Llama-2-7b Models

Developers

ไปฅไธ‹ใ‚ขใƒซใƒ•ใ‚กใƒ™ใƒƒใƒˆ้ †

Licence

Llama 2 is licensed under the LLAMA 2 Community License, Copyright (c) Meta Platforms, Inc. All Rights Reserved.

How to Cite

@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},
}

Citations

@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}
}
Downloads last month
2,852
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for elyza/ELYZA-japanese-Llama-2-7b

Adapters
2 models
Merges
5 models

Spaces using elyza/ELYZA-japanese-Llama-2-7b 25

Collection including elyza/ELYZA-japanese-Llama-2-7b