ij5 commited on
Commit
a6ece63
ยท
verified ยท
1 Parent(s): cc667e2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -0
README.md CHANGED
@@ -12,6 +12,28 @@ model-index:
12
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
13
  should probably proofread and complete it, then remove this comment. -->
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  # correction
16
 
17
  This model is a fine-tuned version of [paust/pko-t5-base](https://huggingface.co/paust/pko-t5-base) on the None dataset.
 
12
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
13
  should probably proofread and complete it, then remove this comment. -->
14
 
15
+ # Basic Inference
16
+ ```python
17
+ from transformers import T5TokenizerFast, T5ForConditionalGeneration
18
+
19
+ tokenizer = T5TokenizerFast.from_pretrained('ij5/whitespace-correction')
20
+ model = T5ForConditionalGeneration.from_pretrained('ij5/whitespace-correction')
21
+
22
+ def fix_whitespace(text):
23
+ inputs = f"๋„์–ด์“ฐ๊ธฐ ๊ต์ •: {text}"
24
+ tokenized = tokenizer(inputs, max_length=128, truncation=True, return_tensors='pt').to('cuda')
25
+ output_ids = model.generate(
26
+ input_ids=tokenized['input_ids'],
27
+ attention_mask=tokenized['attention_mask'],
28
+ max_length=128,
29
+ )
30
+ return tokenizer.decode(output_ids[0], skip_special_tokens=True)
31
+
32
+
33
+ print(fix_whitespace("ํ”๋“ค ๋ฆฌ๋Š” ๊ฐ€์ง€ ์‚ฌ์ด๋กœ ๋ถˆ์‘ฅ ๋ฐ”๋žŒ์˜ ํ˜•์ƒ ์ด ๋“œ ๋Ÿฌ๋‚˜๊ธฐ๋ผ๋„ ํ•  ๊ฒƒ์ฒ˜๋Ÿผ."))
34
+ # result: ํ”๋“ค๋ฆฌ๋Š” ๊ฐ€์ง€ ์‚ฌ์ด๋กœ ๋ถˆ์‘ฅ ๋ฐ”๋žŒ์˜ ํ˜•์ƒ์ด ๋“œ๋Ÿฌ๋‚˜๊ธฐ๋ผ๋„ ํ•  ๊ฒƒ์ฒ˜๋Ÿผ.
35
+ ```
36
+
37
  # correction
38
 
39
  This model is a fine-tuned version of [paust/pko-t5-base](https://huggingface.co/paust/pko-t5-base) on the None dataset.