File size: 2,204 Bytes
0985e17
 
 
6e52648
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3eb622
6e52648
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
license: cc-by-nc-4.0
---

# tsubaki-10b

# Overview
This repository provides a Japanese-centric multilingual GPT-NeoX model of 10 billion parameters.

* **Library**
    
    The model was trained using code based on [EleutherAI/gpt-neox](https://github.com/EleutherAI/gpt-neox).

* **Model architecture**

    A 36-layer, 4864-hidden-size transformer-based language model.

* **Pre-training**

    The model was trained on around **600B** tokens from a mixture of the following corpora

    - [Japanese C4](https://huggingface.co/datasets/mc4)
    - [The Pile](https://huggingface.co/datasets/EleutherAI/pile)

* **Model Series**

    | Variant | Link |
    | :-- | :--|
    | tsubaki-10b-instruction-sft | https://huggingface.co/Kojima777/tsubaki-10b-instruction-sft |
    | tsubaki-10b | https://huggingface.co/Kojima777/tsubaki-10b |

* **Authors**
    
    Takeshi Kojima

---

# Benchmarking

* **Japanese benchmark**

    - *The 4-task average accuracy is based on results of JCommonsenseQA, JNLI, MARC-ja, and JSQuAD.*
   
    | Model | Average | JCommonsenseQA | JNLI | MARC-ja | JSQuAD |
    | :-- | :-- | :-- | :-- | :-- | :-- |
    | tsubaki-10b-instruction-sft | 79.04 | 74.35 | 65.65 | 96.06 | 80.09 |
    | tsubaki-10b | 67.27 | 65.86 | 54.19 | 84.49 | 64.54 |

---

# How to use the model

~~~~python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("Kojima777/tsubaki-10b", use_fast=False)
model = AutoModelForCausalLM.from_pretrained("Kojima777/tsubaki-10b")

if torch.cuda.is_available():
    model = model.to("cuda")

text = "吾輩は猫である。"
token_ids = tokenizer.encode(text, add_special_tokens=False, return_tensors="pt")

with torch.no_grad():
    output_ids = model.generate(
        token_ids.to(model.device),
        max_new_tokens=100,
        do_sample=True,
        temperature=0.6,
        top_p=0.9,
        pad_token_id=tokenizer.pad_token_id,
        bos_token_id=tokenizer.bos_token_id,
        eos_token_id=tokenizer.eos_token_id
    )

output = tokenizer.decode(output_ids.tolist()[0])
print(output)

~~~~
---

# Licenese
[cc-by-nc-4.0](https://creativecommons.org/licenses/by-nc/4.0/)