This repository provides an English-Japanese bilingual GPT-NeoX model of 3.8 billion parameters.
-
Library
The model was trained using code based on
EleutherAI/gpt-neox.
-
Model architecture
A 36-layer, 2816-hidden-size transformer-based language model.
-
Pre-training
The model was trained on around 524B tokens from a mixture of the following corpora
-
Model Series
-
Contributors
-
Release date
July 31, 2023
1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4tokenizer = AutoTokenizer.from_pretrained("rinna/bilingual-gpt-neox-4b", use_fast=False)
5model = AutoModelForCausalLM.from_pretrained("rinna/bilingual-gpt-neox-4b")
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=100,
17 min_new_tokens=100,
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「知識を、自分のものと考えることに満足していると、自己の限界に目覚めることを忘れてしまう。しかし、他者との協同なしには、自己の本当の理解に達することはできないのだ。知識は他者と相互の、協同の力によってこそ、得られるのである。」(引用終わり)
31この一節を、私たちは今から学び直すべきです。そして、これからの社会をリードする子どもたちに、その能力を伸ばすべく、
32"""
1text = "Socrates says"
2token_ids = tokenizer.encode(text, add_special_tokens=False, return_tensors="pt")
3
4with torch.no_grad():
5 output_ids = model.generate(
6 token_ids.to(model.device),
7 max_new_tokens=100,
8 min_new_tokens=100,
9 do_sample=True,
10 temperature=1.0,
11 top_p=0.95,
12 pad_token_id=tokenizer.pad_token_id,
13 bos_token_id=tokenizer.bos_token_id,
14 eos_token_id=tokenizer.eos_token_id
15 )
16
17output = tokenizer.decode(output_ids.tolist()[0])
18print(output)
19
20"""
21Socrates says: he thinks that philosophy, as opposed to myth, can be demonstrated; as opposed to poetry, that it is not possible to have knowledge of the unknowable (that is, neither by reason nor by any art of divination). So in this case he is in agreement with Socrates in not thinking that we could prove the existence of the gods or of fate. Now, I do not know the content of Xenophon's _Symposium_, but he must have made a point of this passage that has ex
22"""
1text = "def bubble_sort(array):"
2token_ids = tokenizer.encode(text, add_special_tokens=False, return_tensors="pt")
3
4with torch.no_grad():
5 output_ids = model.generate(
6 token_ids.to(model.device),
7 max_new_tokens=200,
8 min_new_tokens=200,
9 do_sample=True,
10 temperature=1.0,
11 top_p=0.5,
12 pad_token_id=tokenizer.pad_token_id,
13 bos_token_id=tokenizer.bos_token_id,
14 eos_token_id=tokenizer.eos_token_id
15 )
16
17output = tokenizer.decode(output_ids.tolist()[0])
18print(output)
19"""
20def bubble_sort(array):
21 for i in range(len(array)):
22 for j in range(len(array)-1):
23 if array[j] > array[j+1]:
24 array[j], array[j+1] = array[j+1], array[j]
25 return array
26
27print(bubble_sort([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))
28
29The code above will sort the array from 1 to 10 in the following order:
301, 2, 3, 4, 5, 6, 7, 8, 9, 10
31
32However, I am not sure how to do
33"""
1@misc{rinna-bilingual-gpt-neox-4b,
2 title = {rinna/bilingual-gpt-neox-4b},
3 author = {Zhao, Tianyu and Wakatsuki, Toshiaki and Kaga, Akio and Mitsuda, Koh and Sawada, Kei},
4 url = {https://huggingface.co/rinna/bilingual-gpt-neox-4b}
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}