j5ng commited on
Commit
be443f3
โ€ข
1 Parent(s): 74e500e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -7
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
- model = model.to('mps:0') # for mac m1
34
- # model = model.to('cuda:0') # for nvidia cuda
 
 
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('mps:0')
43
- attention_mask = input_encoding.attention_mask.to('mps:0')
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(