Update README.md
Browse files
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.
|