damerajee commited on
Commit
97ddd2f
1 Parent(s): 136a57f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +39 -5
README.md CHANGED
@@ -8,19 +8,53 @@ pipeline_tag: text2text-generation
8
  tags:
9
  - translation
10
  - Bilingual
 
 
 
11
  ---
12
- # Model
 
13
 
14
  <img src="https://cdn-uploads.huggingface.co/production/uploads/6487239cca30096ea9f52115/Rsixw_aSB-ytZT7VEQ06c.jpeg" width="500" height="500" alt="Image">
15
 
 
16
 
17
- # Steps to try the model
 
 
18
 
19
- # Load the model
 
 
 
 
 
20
 
21
- # Inference
 
 
 
 
 
 
 
 
 
 
22
 
23
  # Training details
 
 
 
 
24
 
25
- # Dataset
26
 
 
 
 
 
 
 
 
 
 
 
8
  tags:
9
  - translation
10
  - Bilingual
11
+ datasets:
12
+ - Aarif1430/english-to-hindi
13
+ - Sampuran01/english-hindi-translation
14
  ---
15
+ # Model Description
16
+ The base model [sarvamai/OpenHathi-7B-Hi-v0.1-Base](https://huggingface.co/sarvamai/OpenHathi-7B-Hi-v0.1-Base) was finetuned using [Unsloth](https://github.com/unslothai/unsloth)
17
 
18
  <img src="https://cdn-uploads.huggingface.co/production/uploads/6487239cca30096ea9f52115/Rsixw_aSB-ytZT7VEQ06c.jpeg" width="500" height="500" alt="Image">
19
 
20
+ # Steps to try the model :
21
 
22
+ ## Load the model
23
+ ```python
24
+ from transformers import AutoTokenizer, AutoModelForCausalLM
25
 
26
+ tokenizer = AutoTokenizer.from_pretrained("damerajee/openhathi-h2e-e2h")
27
+ model = AutoModelForCausalLM.from_pretrained("damerajee/openhathi-h2e-e2h")
28
+ ```
29
+ ## Inference
30
+ ```python
31
+ inputs = tokenizer(["[INST]translate this from english to hindi: Be a free thinker and don't accept everything you hear as truth. Be critical and evaluate what you believe in. [/INST]<s> hindi output:"]*1, return_tensors = "pt").to("cuda")
32
 
33
+ outputs = model.generate(**inputs, max_new_tokens = 18, use_cache = True)
34
+ tokenizer.batch_decode(outputs)
35
+
36
+ ```
37
+ ```python
38
+ inputs = tokenizer(["[INST]translate this from english to hindi: Be a free thinker and don't accept everything you hear as truth. Be critical and evaluate what you believe in. [/INST]<s> hindi output:"]*1, return_tensors = "pt").to("cuda")
39
+
40
+ outputs = model.generate(**inputs, max_new_tokens = 18, use_cache = True)
41
+ tokenizer.batch_decode(outputs)
42
+
43
+ ```
44
 
45
  # Training details
46
+ * The model was loaded in 4-Bit
47
+ * The target modules include "q_proj", "k_proj", "v_proj", "o_proj"
48
+ * The training took about 2 hours approximately
49
+ * The fine-tuning was done on a free goggle colab with a single t4 GPU (huge thanks to unsloth for this)
50
 
 
51
 
52
+ # Dataset
53
+ * The dataset used was the combination of two dataset which gave a total of 1_786_788 rows of hindi text
54
+ * The rows were then pre-process to look something like this :
55
+
56
+ ```python
57
+ [INST]translate this from english to hindi: When it is said to him: \'Fear Allah\' egotism takes him in his sin. Gehenna (Hell) shall be enough for him. How evil a cradling! [/INST] hindi output: और जब उससे कहा जाता है,
58
+ "अल्लाह से डर", तो अहंकार उसे और गुनाह पर जमा देता है। अतः उसके लिए तो जहन्नम ही काफ़ी है, और वह बहुत-ही बुरी शय्या है! '
59
+ ```
60
+ * This was done for both english to hindi and hindi to english hence the name h2e and e2h