RichardErkhov
commited on
Commit
•
4041590
1
Parent(s):
5756396
uploaded readme
Browse files
README.md
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Quantization made by Richard Erkhov.
|
2 |
+
|
3 |
+
[Github](https://github.com/RichardErkhov)
|
4 |
+
|
5 |
+
[Discord](https://discord.gg/pvy7H8DZMG)
|
6 |
+
|
7 |
+
[Request more models](https://github.com/RichardErkhov/quant_request)
|
8 |
+
|
9 |
+
|
10 |
+
japanese-gpt-1b - bnb 8bits
|
11 |
+
- Model creator: https://huggingface.co/rinna/
|
12 |
+
- Original model: https://huggingface.co/rinna/japanese-gpt-1b/
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
Original model description:
|
18 |
+
---
|
19 |
+
language: ja
|
20 |
+
thumbnail: https://github.com/rinnakk/japanese-pretrained-models/blob/master/rinna.png
|
21 |
+
tags:
|
22 |
+
- gpt
|
23 |
+
- text-generation
|
24 |
+
- lm
|
25 |
+
- nlp
|
26 |
+
license: mit
|
27 |
+
datasets:
|
28 |
+
- cc100
|
29 |
+
- wikipedia
|
30 |
+
- c4
|
31 |
+
widget:
|
32 |
+
- text: "西田幾多郎は、"
|
33 |
+
---
|
34 |
+
|
35 |
+
# japanese-gpt-1b
|
36 |
+
|
37 |
+
![rinna-icon](./rinna.png)
|
38 |
+
|
39 |
+
This repository provides a 1.3B-parameter Japanese GPT model. The model was trained by [rinna Co., Ltd.](https://corp.rinna.co.jp/)
|
40 |
+
|
41 |
+
# How to use the model
|
42 |
+
|
43 |
+
~~~~
|
44 |
+
import torch
|
45 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
46 |
+
|
47 |
+
tokenizer = AutoTokenizer.from_pretrained("rinna/japanese-gpt-1b", use_fast=False)
|
48 |
+
model = AutoModelForCausalLM.from_pretrained("rinna/japanese-gpt-1b")
|
49 |
+
|
50 |
+
if torch.cuda.is_available():
|
51 |
+
model = model.to("cuda")
|
52 |
+
|
53 |
+
text = "西田幾多郎は、"
|
54 |
+
token_ids = tokenizer.encode(text, add_special_tokens=False, return_tensors="pt")
|
55 |
+
|
56 |
+
with torch.no_grad():
|
57 |
+
output_ids = model.generate(
|
58 |
+
token_ids.to(model.device),
|
59 |
+
max_length=100,
|
60 |
+
min_length=100,
|
61 |
+
do_sample=True,
|
62 |
+
top_k=500,
|
63 |
+
top_p=0.95,
|
64 |
+
pad_token_id=tokenizer.pad_token_id,
|
65 |
+
bos_token_id=tokenizer.bos_token_id,
|
66 |
+
eos_token_id=tokenizer.eos_token_id,
|
67 |
+
bad_words_ids=[[tokenizer.unk_token_id]]
|
68 |
+
)
|
69 |
+
|
70 |
+
output = tokenizer.decode(output_ids.tolist()[0])
|
71 |
+
print(output)
|
72 |
+
# sample output: 西田幾多郎は、その主著の「善の研究」などで、人間の内面に自然とその根源があると指摘し、その根源的な性格は、この西田哲学を象徴しているとして、カントの「純粋理性批判」と「判断力批判」を対比して捉えます。それは、「人が理性的存在であるかぎりにおいて、人はその当人に固有な道徳的に自覚された善悪の基準を持っている」とするもので、この理性的な善悪の観念を否定するのがカントの
|
73 |
+
~~~~
|
74 |
+
|
75 |
+
# Model architecture
|
76 |
+
A 24-layer, 2048-hidden-size transformer-based language model.
|
77 |
+
|
78 |
+
# Training
|
79 |
+
The model was trained on [Japanese C4](https://huggingface.co/datasets/allenai/c4), [Japanese CC-100](http://data.statmt.org/cc-100/ja.txt.xz) and [Japanese Wikipedia](https://dumps.wikimedia.org/other/cirrussearch) to optimize a traditional language modelling objective. It reaches around 14 perplexity on a chosen validation set from the same data.
|
80 |
+
|
81 |
+
# Tokenization
|
82 |
+
The model uses a [sentencepiece](https://github.com/google/sentencepiece)-based tokenizer. The vocabulary was first trained on a selected subset from the training data using the official sentencepiece training script, and then augmented with emojis and symbols.
|
83 |
+
|
84 |
+
# How to cite
|
85 |
+
```bibtex
|
86 |
+
@misc{rinna-japanese-gpt-1b,
|
87 |
+
title = {rinna/japanese-gpt-1b},
|
88 |
+
author = {Zhao, Tianyu and Sawada, Kei},
|
89 |
+
url = {https://huggingface.co/rinna/japanese-gpt-1b}
|
90 |
+
}
|
91 |
+
|
92 |
+
@inproceedings{sawada2024release,
|
93 |
+
title = {Release of Pre-Trained Models for the {J}apanese Language},
|
94 |
+
author = {Sawada, Kei and Zhao, Tianyu and Shing, Makoto and Mitsui, Kentaro and Kaga, Akio and Hono, Yukiya and Wakatsuki, Toshiaki and Mitsuda, Koh},
|
95 |
+
booktitle = {Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)},
|
96 |
+
month = {5},
|
97 |
+
year = {2024},
|
98 |
+
pages = {13898--13905},
|
99 |
+
url = {https://aclanthology.org/2024.lrec-main.1213},
|
100 |
+
note = {\url{https://arxiv.org/abs/2404.01657}}
|
101 |
+
}
|
102 |
+
```
|
103 |
+
|
104 |
+
# Licenese
|
105 |
+
[The MIT license](https://opensource.org/licenses/MIT)
|
106 |
+
|
107 |
+
|