Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,93 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
# Dataset
|
5 |
+
|
6 |
+
Japanese subset of the mC4 dataset
|
7 |
+
|
8 |
+
# Training
|
9 |
+
|
10 |
+
Trained for 3000 steps on top of the MPT 7b checkpoint mosaicml/mpt-7b
|
11 |
+
|
12 |
+
# How to load
|
13 |
+
|
14 |
+
Before running this model, please install the following pip package:
|
15 |
+
|
16 |
+
```bash
|
17 |
+
pip install einops
|
18 |
+
```
|
19 |
+
|
20 |
+
To run this model, you may need to load it in a lower precision in order for it to fit onto your GPU. We found for a T4 GPU, it requires loading the model in 8-bit precision. To load the model in 8-bit or 4-bit, please install the following pip packages:
|
21 |
+
|
22 |
+
```bash
|
23 |
+
pip install bitsandbytes accelerate
|
24 |
+
```
|
25 |
+
|
26 |
+
Caution - you will also need enough RAM to load the model. We estimate loading this model requires ~30GB.
|
27 |
+
|
28 |
+
<details>
|
29 |
+
<summary><b>Auto type</b></summary>
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
```python
|
34 |
+
from transformers import AutoModelForCausalLM
|
35 |
+
|
36 |
+
model_name = "lightblue/japanese-mpt-7b"
|
37 |
+
model = AutoModelForCausalLM.from_pretrained(
|
38 |
+
model_name,
|
39 |
+
torch_dtype='auto',
|
40 |
+
trust_remote_code=True
|
41 |
+
)
|
42 |
+
```
|
43 |
+
|
44 |
+
</details>
|
45 |
+
<details>
|
46 |
+
<summary><b>In 8 bit</b></summary>
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
```python
|
51 |
+
from transformers import AutoModelForCausalLM
|
52 |
+
|
53 |
+
model_name = "lightblue/japanese-mpt-7b"
|
54 |
+
model = AutoModelForCausalLM.from_pretrained(
|
55 |
+
model_name,
|
56 |
+
torch_dtype='auto',
|
57 |
+
load_in_8bit=True,
|
58 |
+
trust_remote_code=True
|
59 |
+
)
|
60 |
+
```
|
61 |
+
|
62 |
+
</details>
|
63 |
+
|
64 |
+
<details>
|
65 |
+
<summary><b>In 4 bit</b></summary>
|
66 |
+
|
67 |
+
|
68 |
+
|
69 |
+
```python
|
70 |
+
from transformers import AutoModelForCausalLM
|
71 |
+
|
72 |
+
model_name = "lightblue/japanese-mpt-7b"
|
73 |
+
model = AutoModelForCausalLM.from_pretrained(
|
74 |
+
model_name,
|
75 |
+
torch_dtype='auto',
|
76 |
+
load_in_4bit=True,
|
77 |
+
trust_remote_code=True
|
78 |
+
)
|
79 |
+
```
|
80 |
+
|
81 |
+
</details>
|
82 |
+
|
83 |
+
|
84 |
+
# How to use
|
85 |
+
```python
|
86 |
+
from transformers import AutoTokenizer, pipeline
|
87 |
+
|
88 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
89 |
+
|
90 |
+
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
91 |
+
|
92 |
+
pipe("こんにちは", temperature=0, do_sample=False, return_full_text=False, max_new_tokens=32)
|
93 |
+
```
|