Madhour commited on
Commit
f7321be
1 Parent(s): 496c4dc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +23 -2
README.md CHANGED
@@ -20,7 +20,7 @@ inference:
20
  parameters:
21
  temperature: 90.0
22
  return_full_text: False
23
- repetition_penalty: 20.0
24
 
25
 
26
  ---
@@ -28,4 +28,25 @@ inference:
28
 
29
  Given a few keywords, it generates an Eli5 question with a corresponding answer.
30
 
31
- The model is mainly used for [SeemsPhishy](https://github.com/madhour/seemsphishy) to auto generate newsletters for phishing/penetration-testing.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  parameters:
21
  temperature: 90.0
22
  return_full_text: False
23
+ repetition_penalty: 20
24
 
25
 
26
  ---
 
28
 
29
  Given a few keywords, it generates an Eli5 question with a corresponding answer.
30
 
31
+ The model is mainly used for [SeemsPhishy](https://github.com/madhour/seemsphishy) to auto generate newsletters for phishing/penetration-testing.
32
+
33
+ # How to use
34
+
35
+ ```
36
+ from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
37
+ from torch import tensor
38
+
39
+ tokenizer = AutoTokenizer.from_pretrained("Madhour/gpt2-eli5")
40
+ model = AutoModelForCausalLM.from_pretrained("Madhour/gpt2-eli5")
41
+ prompt = <|BOS|> +"I have a question."+ <|SEP|> + "keyword1,keyword2,keyword3" + <|SEP|>
42
+ prompt = tensor(tokenizer.encode(prompt)).unsqueeze(0)
43
+ text = model.generate(prompt,
44
+ do_sample=True,
45
+ min_length=50,
46
+ max_length=768,
47
+ top_k=30,
48
+ top_p=0.7,
49
+ temperature=0.9,
50
+ repetition_penalty=2.0,
51
+ num_return_sequences=3)
52
+ ```