Update README.md
Browse files
README.md
CHANGED
|
@@ -39,6 +39,7 @@ pad_id = tokenizer._convert_token_to_id_with_added_voc("<pad>")
|
|
| 39 |
inp = tokenizer("I am a boy </s> <2en>", add_special_tokens=False, return_tensors="pt", padding=True).input_ids # tensor([[ 466, 1981, 80, 25573, 64001, 64004]])
|
| 40 |
|
| 41 |
out = tokenizer("<2hi> मैं एक लड़का हूँ </s>", add_special_tokens=False, return_tensors="pt", padding=True).input_ids # tensor([[64006, 942, 43, 32720, 8384, 64001]])
|
|
|
|
| 42 |
|
| 43 |
model_outputs=model(input_ids=inp, decoder_input_ids=out[:,0:-1], labels=out[:,1:])
|
| 44 |
|
|
@@ -60,6 +61,7 @@ model_output=model.generate(inp, use_cache=True, num_beams=4, max_length=20, min
|
|
| 60 |
decoded_output=tokenizer.decode(model_output[0], skip_special_tokens=True, clean_up_tokenization_spaces=False)
|
| 61 |
|
| 62 |
print(decoded_output) # I am a boy
|
|
|
|
| 63 |
|
| 64 |
# What if we mask?
|
| 65 |
|
|
|
|
| 39 |
inp = tokenizer("I am a boy </s> <2en>", add_special_tokens=False, return_tensors="pt", padding=True).input_ids # tensor([[ 466, 1981, 80, 25573, 64001, 64004]])
|
| 40 |
|
| 41 |
out = tokenizer("<2hi> मैं एक लड़का हूँ </s>", add_special_tokens=False, return_tensors="pt", padding=True).input_ids # tensor([[64006, 942, 43, 32720, 8384, 64001]])
|
| 42 |
+
# Note that if you use any language other than Hindi or Marathi, you should convert its script to Devanagari using the Indic NLP Library.
|
| 43 |
|
| 44 |
model_outputs=model(input_ids=inp, decoder_input_ids=out[:,0:-1], labels=out[:,1:])
|
| 45 |
|
|
|
|
| 61 |
decoded_output=tokenizer.decode(model_output[0], skip_special_tokens=True, clean_up_tokenization_spaces=False)
|
| 62 |
|
| 63 |
print(decoded_output) # I am a boy
|
| 64 |
+
# Note that if your output language is not Hindi or Marathi, you should convert its script from Devanagari to the desired language using the Indic NLP Library.
|
| 65 |
|
| 66 |
# What if we mask?
|
| 67 |
|