Update README.md
Browse files
README.md
CHANGED
@@ -30,8 +30,10 @@ from transformers import T5ForConditionalGeneration, T5Tokenizer
|
|
30 |
model = T5ForConditionalGeneration.from_pretrained("j5ng/et5-typos-corrector")
|
31 |
tokenizer = T5Tokenizer.from_pretrained("j5ng/et5-typos-corrector")
|
32 |
|
33 |
-
|
34 |
-
#
|
|
|
|
|
35 |
|
36 |
# ์์ ์
๋ ฅ ๋ฌธ์ฅ
|
37 |
input_text = "์๋ฌ ์ง์ง ๋ฌดใ
ํ๋๊ณ "
|
@@ -39,11 +41,8 @@ input_text = "์๋ฌ ์ง์ง ๋ฌดใ
ํ๋๊ณ "
|
|
39 |
# ์
๋ ฅ ๋ฌธ์ฅ ์ธ์ฝ๋ฉ
|
40 |
input_encoding = tokenizer("๋ง์ถค๋ฒ์ ๊ณ ์ณ์ฃผ์ธ์: " + input_text, return_tensors="pt")
|
41 |
|
42 |
-
input_ids = input_encoding.input_ids.to(
|
43 |
-
attention_mask = input_encoding.attention_mask.to(
|
44 |
-
|
45 |
-
# input_ids = input_encoding.input_ids.to('cuda:0') # for nvidia cuda
|
46 |
-
# attention_mask = input_encoding.attention_mask.to('cuda:0') # for nvidia cuda
|
47 |
|
48 |
# T5 ๋ชจ๋ธ ์ถ๋ ฅ ์์ฑ
|
49 |
output_encoding = model.generate(
|
|
|
30 |
model = T5ForConditionalGeneration.from_pretrained("j5ng/et5-typos-corrector")
|
31 |
tokenizer = T5Tokenizer.from_pretrained("j5ng/et5-typos-corrector")
|
32 |
|
33 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
34 |
+
# device = "mps:0" if torch.cuda.is_available() else "cpu" # for mac m1
|
35 |
+
|
36 |
+
model = model.to(device)
|
37 |
|
38 |
# ์์ ์
๋ ฅ ๋ฌธ์ฅ
|
39 |
input_text = "์๋ฌ ์ง์ง ๋ฌดใ
ํ๋๊ณ "
|
|
|
41 |
# ์
๋ ฅ ๋ฌธ์ฅ ์ธ์ฝ๋ฉ
|
42 |
input_encoding = tokenizer("๋ง์ถค๋ฒ์ ๊ณ ์ณ์ฃผ์ธ์: " + input_text, return_tensors="pt")
|
43 |
|
44 |
+
input_ids = input_encoding.input_ids.to(device)
|
45 |
+
attention_mask = input_encoding.attention_mask.to(device)
|
|
|
|
|
|
|
46 |
|
47 |
# T5 ๋ชจ๋ธ ์ถ๋ ฅ ์์ฑ
|
48 |
output_encoding = model.generate(
|