MrBananaHuman
commited on
Commit
ยท
815bda9
1
Parent(s):
f9f9853
Update README.md
Browse files
README.md
CHANGED
@@ -3,6 +3,7 @@ kakao brain์์ ๊ณต๊ฐํ kogpt 6b model('kakaobrain/kogpt')์ fp16์ผ๋ก ์
|
|
3 |
### ์นด์นด์ค๋ธ๋ ์ธ ๋ชจ๋ธ์ fp16์ผ๋ก ๋ก๋ํ๋ ๋ฐฉ๋ฒ
|
4 |
|
5 |
```
|
|
|
6 |
from transformers import GPTJForCausalLM
|
7 |
|
8 |
model = GPTJForCausalLM.from_pretrained('kakaobrain/kogpt', cache_dir='./my_dir', revision='KoGPT6B-ryan1.5b', torch_dtype=torch.float16)
|
@@ -11,14 +12,18 @@ model = GPTJForCausalLM.from_pretrained('kakaobrain/kogpt', cache_dir='./my_dir'
|
|
11 |
### fp16 ๋ชจ๋ธ ๋ก๋ ํ ๋ฌธ์ฅ ์์ฑ
|
12 |
|
13 |
```
|
|
|
14 |
from transformers import GPTJForCausalLM, AutoTokenizer
|
15 |
|
16 |
-
model = GPTJForCausalLM.from_pretrained('MrBananaHuman/kogpt_6b_fp16')
|
17 |
model.to('cuda')
|
18 |
tokenizer = AutoTokenizer.from_pretrained('MrBananaHuman/kogpt_6b_fp16')
|
19 |
|
20 |
input_text = '์ด์์ ์'
|
21 |
-
input_ids = tokenizer
|
|
|
|
|
|
|
22 |
|
23 |
```
|
24 |
|
|
|
3 |
### ์นด์นด์ค๋ธ๋ ์ธ ๋ชจ๋ธ์ fp16์ผ๋ก ๋ก๋ํ๋ ๋ฐฉ๋ฒ
|
4 |
|
5 |
```
|
6 |
+
import torch
|
7 |
from transformers import GPTJForCausalLM
|
8 |
|
9 |
model = GPTJForCausalLM.from_pretrained('kakaobrain/kogpt', cache_dir='./my_dir', revision='KoGPT6B-ryan1.5b', torch_dtype=torch.float16)
|
|
|
12 |
### fp16 ๋ชจ๋ธ ๋ก๋ ํ ๋ฌธ์ฅ ์์ฑ
|
13 |
|
14 |
```
|
15 |
+
import torch
|
16 |
from transformers import GPTJForCausalLM, AutoTokenizer
|
17 |
|
18 |
+
model = GPTJForCausalLM.from_pretrained('MrBananaHuman/kogpt_6b_fp16', torch_dtype=torch.float16)
|
19 |
model.to('cuda')
|
20 |
tokenizer = AutoTokenizer.from_pretrained('MrBananaHuman/kogpt_6b_fp16')
|
21 |
|
22 |
input_text = '์ด์์ ์'
|
23 |
+
input_ids = tokenizer(input_text, return_tensors='pt').to('cuda')
|
24 |
+
|
25 |
+
output = model.generate(**input_ids)
|
26 |
+
print(tokenizer.decode(output[0]))
|
27 |
|
28 |
```
|
29 |
|