Sharathhebbar24 commited on
Commit
abe390e
1 Parent(s): e1adb48

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -6
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
- >>>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
  ```
 
33
  >>> model_name = "Sharathhebbar24/Instruct_GPT"
34
  >>> model = AutoModelForCausalLM.from_pretrained(model_name)
35
  >>> tokenizer = AutoTokenizer.from_pretrained("gpt2-medium")
36
+ >>> def generate_text(prompt):
37
+ >>> inputs = tokenizer.encode(prompt, return_tensors='pt')
38
+ >>> outputs = mod1.generate(inputs, max_length=64, pad_token_id=tokenizer.eos_token_id)
39
+ >>> generated = tokenizer.decode(outputs[0], skip_special_tokens=True)
40
+ >>> return generated[:generated.rfind(".")+1]
41
 
42
  >>> generate_text("Should I Invest in stocks")
43
 
44
+ Should I Invest in stocks? Investing in stocks is a great way to diversify your portfolio. You can invest in stocks based on the market's performance, or you can invest in stocks based on the company's performance.
45
  ```