We conduct continual pre-training of
llama2-7b on
40B tokens from a mixture of Japanese and English datasets. The continual pre-training significantly improves the model's performance on Japanese tasks.
The name
youri comes from the Japanese word
妖狸/ようり/Youri, which is a kind of Japanese mythical creature (
妖怪/ようかい/Youkai).
1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4tokenizer = AutoTokenizer.from_pretrained("rinna/youri-7b")
5model = AutoModelForCausalLM.from_pretrained("rinna/youri-7b")
6
7if torch.cuda.is_available():
8 model = model.to("cuda")
9
10text = "西田幾多郎は、"
11token_ids = tokenizer.encode(text, add_special_tokens=False, return_tensors="pt")
12
13with torch.no_grad():
14 output_ids = model.generate(
15 token_ids.to(model.device),
16 max_new_tokens=200,
17 min_new_tokens=200,
18 do_sample=True,
19 temperature=1.0,
20 top_p=0.95,
21 pad_token_id=tokenizer.pad_token_id,
22 bos_token_id=tokenizer.bos_token_id,
23 eos_token_id=tokenizer.eos_token_id
24 )
25
26output = tokenizer.decode(output_ids.tolist()[0])
27print(output)
28"""
29西田幾多郎は、プラトンの復権を主張し、対する従来の西洋哲学は、近代の合理主義哲学に委ね、「従来の哲学は破 壊されてしまった」と述べている。 西田幾多郎は、西洋近代哲学の「徹底的な検討」を拒んだ。それは、「現代的理解の脆弱性を補う筈の、従来のヨーロッパに伝わる哲学的な方法では到底それができなかったからである」とい
30"""
The model uses the original llama-2 tokenizer.
1@misc{rinna-youri-7b,
2 title = {rinna/youri-7b},
3 author = {Zhao, Tianyu and Kaga, Akio and Sawada, Kei},
4 url = {https://huggingface.co/rinna/youri-7b}
5}
6
7@inproceedings{sawada2024release,
8 title = {Release of Pre-Trained Models for the {J}apanese Language},
9 author = {Sawada, Kei and Zhao, Tianyu and Shing, Makoto and Mitsui, Kentaro and Kaga, Akio and Hono, Yukiya and Wakatsuki, Toshiaki and Mitsuda, Koh},
10 booktitle = {Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)},
11 month = {5},
12 year = {2024},
13 pages = {13898--13905},
14 url = {https://aclanthology.org/2024.lrec-main.1213},
15 note = {\url{https://arxiv.org/abs/2404.01657}}
16}
1@software{gpt-neox-library,
2 title = {{GPT}-{N}eo{X}: Large Scale Autoregressive Language Modeling in {P}y{T}orch},
3 author = {Andonian, Alex and Anthony, Quentin and Biderman, Stella and Black, Sid and Gali, Preetham and Gao, Leo and Hallahan, Eric and Levy-Kramer, Josh and Leahy, Connor and Nestler, Lucas and Parker, Kip and Pieler, Michael and Purohit, Shivanshu and Songz, Tri and Phil, Wang and Weinbach, Samuel},
4 doi = {10.5281/zenodo.5879544},
5 month = {8},
6 year = {2021},
7 version = {0.0.1},
8 url = {https://www.github.com/eleutherai/gpt-neox}
9}
Detailed results can be found
here