Abhishekcr448 commited on
Commit
613f428
·
verified ·
1 Parent(s): 1500e21

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -8
README.md CHANGED
@@ -34,14 +34,19 @@ model, tokenizer = (AutoModelForCausalLM.from_pretrained("Abhishekcr448/Tiny-Hin
34
  # Function to generate text
35
  def generate_text(prompt):
36
  inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
37
- print(tokenizer.decode(model.generate(inputs['input_ids'],
38
- max_length=inputs['input_ids'].shape[-1] + 25,
39
- no_repeat_ngram_size=2, temperature=0.8,
40
- top_k=50, top_p=0.9, do_sample=True)[0],
41
- skip_special_tokens=True))
42
-
43
- while (prompt := input("Enter prompt ('exit' to quit): ").lower()) != "exit":
44
- generate_text(prompt)
 
 
 
 
 
45
  ```
46
 
47
  ## Model Details
 
34
  # Function to generate text
35
  def generate_text(prompt):
36
  inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
37
+ output = model.generate(inputs['input_ids'],
38
+ max_length=inputs['input_ids'].shape[-1] + 25,
39
+ no_repeat_ngram_size=2, temperature=0.8,
40
+ top_k=50, top_p=0.9, do_sample=True)
41
+ return tokenizer.decode(output[0], skip_special_tokens=True)
42
+
43
+ # Hardcoded input for testing
44
+ prompt = 'kya kar rahe ho'
45
+ print(generate_text(prompt))
46
+ ```
47
+ **Output**
48
+ ```output
49
+ kya kar rahe ho bas yaar ghar pe hi hoon main toh kabhi kabhi itna kaam karta hoon ki bore ho jata hoon
50
  ```
51
 
52
  ## Model Details