Update README.md
Browse files
README.md
CHANGED
@@ -8,10 +8,20 @@ tags:
|
|
8 |
- multilingual
|
9 |
---
|
10 |
```
|
11 |
-
|
12 |
-
from simpletransformers.t5 import T5Model
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
```
|
|
|
8 |
- multilingual
|
9 |
---
|
10 |
```
|
11 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
|
12 |
|
13 |
+
def transliteration(word: str):
|
14 |
+
model_checkpoint = "eunsour/en-ko-transliterator"
|
15 |
+
|
16 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)
|
17 |
+
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint, src_lang="en", tgt_lang="ko")
|
18 |
+
|
19 |
+
encoded_en = tokenizer(word, truncation=True, max_length=48, return_tensors="pt")
|
20 |
+
generated_tokens = model.generate(**encoded_en)
|
21 |
+
result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
|
22 |
+
|
23 |
+
return result
|
24 |
+
|
25 |
+
transliteration("transformer")
|
26 |
+
# ['트랜스포머']
|
27 |
```
|