Update README.md
Browse files
README.md
CHANGED
@@ -25,22 +25,28 @@ datasets:
|
|
25 |
|
26 |
# Use The Model
|
27 |
|
28 |
-
|
29 |
|
30 |
Load the tokenizer and model
|
|
|
31 |
tokenizer = AutoTokenizer.from_pretrained("Dragneel/Phi-3-mini-Nepali-Text-Summarization-f16")
|
|
|
32 |
model = AutoModelForCausalLM.from_pretrained("Dragneel/Phi-3-mini-Nepali-Text-Summarization-f16")
|
33 |
|
34 |
Example input text
|
|
|
35 |
input_text = "काठमाडौंको बहिराव बसपार्कमा एक भयानक दुर्घटना घटेको थियो। रातको समय थियो र भारी बर्फ जम्मा भएको थियो।"
|
36 |
|
37 |
Tokenize the input text
|
|
|
38 |
input_ids = tokenizer.encode(input_text, return_tensors='pt')
|
39 |
|
40 |
Generate text with adjusted parameters
|
|
|
41 |
outputs = model.generate(input_ids, max_new_tokens=50)
|
42 |
|
43 |
Decode the generated tokens
|
|
|
44 |
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
45 |
|
46 |
print(generated_text)
|
|
|
25 |
|
26 |
# Use The Model
|
27 |
|
28 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
29 |
|
30 |
Load the tokenizer and model
|
31 |
+
|
32 |
tokenizer = AutoTokenizer.from_pretrained("Dragneel/Phi-3-mini-Nepali-Text-Summarization-f16")
|
33 |
+
|
34 |
model = AutoModelForCausalLM.from_pretrained("Dragneel/Phi-3-mini-Nepali-Text-Summarization-f16")
|
35 |
|
36 |
Example input text
|
37 |
+
|
38 |
input_text = "काठमाडौंको बहिराव बसपार्कमा एक भयानक दुर्घटना घटेको थियो। रातको समय थियो र भारी बर्फ जम्मा भएको थियो।"
|
39 |
|
40 |
Tokenize the input text
|
41 |
+
|
42 |
input_ids = tokenizer.encode(input_text, return_tensors='pt')
|
43 |
|
44 |
Generate text with adjusted parameters
|
45 |
+
|
46 |
outputs = model.generate(input_ids, max_new_tokens=50)
|
47 |
|
48 |
Decode the generated tokens
|
49 |
+
|
50 |
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
51 |
|
52 |
print(generated_text)
|