Porjaz commited on
Commit
9bec930
·
verified ·
1 Parent(s): 93b0b80

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -1
README.md CHANGED
@@ -9,4 +9,22 @@ base_model:
9
  ---
10
 
11
  mt-5-base model fine tuned for restoration and recapitalization for Macedonian language.
12
- The model is fine-tuned on a subset of the Macedonian portion of Wikipedia.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  ---
10
 
11
  mt-5-base model fine tuned for restoration and recapitalization for Macedonian language.
12
+ The model is fine-tuned on a subset of the Macedonian portion of Wikipedia.
13
+
14
+
15
+ ## Usage
16
+
17
+ ```python
18
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
19
+ recap_model_name = "Macedonian-ASR/mt5-restore-capitalization-macedonian"
20
+ recap_tokenizer = T5Tokenizer.from_pretrained(recap_model_name)
21
+ recap_model = T5ForConditionalGeneration.from_pretrained(recap_model_name)
22
+ recap_model.to(device)
23
+
24
+ sentence = "скопје е главен град на македонија"
25
+ inputs = recap_tokenizer(["restore capitalization and punctuation: " + sentence], return_tensors="pt", padding=True).to(device)
26
+ outputs = recap_model.generate(**inputs, max_length=768, num_beams=5, early_stopping=True).squeeze(0)
27
+ recap_result = recap_tokenizer.decode(outputs, skip_special_tokens=True)
28
+ print(recap_result)
29
+ -> Скопје е главен град на Македонија.
30
+ ```