akashgoel-id
commited on
Commit
•
e96be08
1
Parent(s):
6d95e2f
Update README.md
Browse files
README.md
CHANGED
@@ -9,4 +9,52 @@ This is a merge of lora trained on English to Hinglish translation dataset by NA
|
|
9 |
|
10 |
|
11 |
You can use the prompt template provided by nateraw
|
12 |
-
"Translate from english to hinglish:\n{{en}}\n---\nTranslation:\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
|
11 |
You can use the prompt template provided by nateraw
|
12 |
+
"Translate from english to hinglish:\n{{en}}\n---\nTranslation:\n"
|
13 |
+
|
14 |
+
|
15 |
+
Sample code:
|
16 |
+
|
17 |
+
from transformers import LlamaForCausalLM, AutoTokenizer
|
18 |
+
import torch
|
19 |
+
|
20 |
+
|
21 |
+
device = "cuda:0"
|
22 |
+
tokenizer = AutoTokenizer.from_pretrained('akashgoel-id/OpenHathi-7B-English-to-Hinglish')
|
23 |
+
model = LlamaForCausalLM.from_pretrained('akashgoel-id/OpenHathi-7B-English-to-Hinglish', torch_dtype=torch.bfloat16).to(device)
|
24 |
+
|
25 |
+
PROMPT_TEMPLATE = (
|
26 |
+
f"Translate from english to hinglish:\n{{en}}\n---\nTranslation:\n"
|
27 |
+
)
|
28 |
+
while True:
|
29 |
+
userInput = input("Enter input: ")
|
30 |
+
prompt = PROMPT_TEMPLATE.format(en=userInput)
|
31 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(device)
|
32 |
+
generate_ids = model.generate(inputs.input_ids, max_length=500)
|
33 |
+
print(tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0])
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
Limitations:
|
39 |
+
The model is still not that good when it comes to idioms
|
40 |
+
|
41 |
+
1) Input : When it rains, it pours
|
42 |
+
Response: Jab baarish hoti hai, to baarish hoti hai
|
43 |
+
Evaluation: This translation is quite literal and misses the idiomatic meaning. The original phrase implies that when something happens, it often happens to an extreme degree. The provided translation simply states that "when it rains, it rains," which doesn't capture the essence of the idiom.
|
44 |
+
2) Input : Don't count your chickens before they hatch
|
45 |
+
Response: Apne murgon ko ande se pahle na ginein
|
46 |
+
Evaluation: This is a reasonable translation of the idiom, maintaining the metaphorical meaning about not making plans based on assumptions of uncertain future events.
|
47 |
+
3) Input : Biting off more than you can chew
|
48 |
+
Response: Aap jo chaba sakte hain usse adhik kaatna
|
49 |
+
Evaluation : This translation captures the literal aspect of biting and chewing but may not fully convey the idiomatic sense of taking on a task that is too big or difficult to handle.
|
50 |
+
4) Input : The ball is in your court
|
51 |
+
Response : Gend aapke court mein hai
|
52 |
+
Evaluation : This translation effectively communicates the meaning of the idiom, which is about it being someone else's turn to make a decision or take an action.
|
53 |
+
5) Input : Beating around the bush
|
54 |
+
Response : Bush ke chaaron or peetna
|
55 |
+
Evaluation : This is a literal translation and doesn't quite capture the idiomatic meaning of avoiding the main point or not speaking directly about a subject. The phrase "Ghumaphira ke baat karna" would be more appropriate.
|
56 |
+
|
57 |
+
|
58 |
+
Next steps:
|
59 |
+
1) The model seems to be highly censored given it used llama2. Next step would be to remove some of censorship by finetuning on more uncensored data. (What WizardLM has done for llama2)
|
60 |
+
2) Finetune on idioms
|