Sharathhebbar24
commited on
Commit
·
e1adb48
1
Parent(s):
65a7572
Update README.md
Browse files
README.md
CHANGED
@@ -33,13 +33,13 @@ prompt.
|
|
33 |
>>> model_name = "Sharathhebbar24/Instruct_GPT"
|
34 |
>>> model = AutoModelForCausalLM.from_pretrained(model_name)
|
35 |
>>> tokenizer = AutoTokenizer.from_pretrained("gpt2-medium")
|
36 |
-
>>>
|
37 |
-
>>>
|
38 |
-
>>>
|
39 |
-
>>>
|
40 |
-
>>>
|
41 |
|
42 |
>>> generate_text("Should I Invest in stocks")
|
43 |
|
44 |
-
|
45 |
```
|
|
|
33 |
>>> model_name = "Sharathhebbar24/Instruct_GPT"
|
34 |
>>> model = AutoModelForCausalLM.from_pretrained(model_name)
|
35 |
>>> tokenizer = AutoTokenizer.from_pretrained("gpt2-medium")
|
36 |
+
>>>def generate_review(text):
|
37 |
+
>>> inputs = tokenizer("review: " + text, return_tensors="pt", max_lenght=512, padding='max_length', truncation=True,)
|
38 |
+
>>> outputs = mod1.generate(inputs['input_ids'], max_length=128, no_repeat_ngram_size=3, num_beams=6, early_stopping=True)
|
39 |
+
>>> summary = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
40 |
+
>>> return summary
|
41 |
|
42 |
>>> generate_text("Should I Invest in stocks")
|
43 |
|
44 |
+
It's good
|
45 |
```
|