Abhishekcr448
commited on
Update README.md
Browse files
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 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
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
|