Benjamin G commited on
Commit
ec6b66c
1 Parent(s): cb1738c

give default values to generator (for examples)

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -45,12 +45,12 @@ class Phi2StoppingCriteria(StoppingCriteria):
45
 
46
  def generate(
47
  prompt,
48
- max_new_tokens,
49
- avoid_hallucinated_prompts,
50
- sampling,
51
- temperature,
52
- top_k,
53
- top_p,
54
  ):
55
  inputs = tokenizer(prompt, return_tensors="pt")
56
  # thanks https://huggingface.co/spaces/joaogante/transformers_streaming/blob/main/app.py
@@ -83,7 +83,7 @@ demo = gr.Interface(
83
  label="prompt",
84
  value="Write a detailed analogy between mathematics and a lighthouse.",
85
  ),
86
- gr.Slider(minimum=0, maximum=500, step=1, value=100, label="max new tokens"),
87
  gr.Checkbox(
88
  value=True,
89
  label="avoid hallucinated prompts",
 
45
 
46
  def generate(
47
  prompt,
48
+ max_new_tokens=75,
49
+ avoid_hallucinated_prompts=True,
50
+ sampling=False,
51
+ temperature=1.0,
52
+ top_k=50,
53
+ top_p=1.0,
54
  ):
55
  inputs = tokenizer(prompt, return_tensors="pt")
56
  # thanks https://huggingface.co/spaces/joaogante/transformers_streaming/blob/main/app.py
 
83
  label="prompt",
84
  value="Write a detailed analogy between mathematics and a lighthouse.",
85
  ),
86
+ gr.Slider(minimum=0, maximum=500, step=1, value=75, label="max new tokens"),
87
  gr.Checkbox(
88
  value=True,
89
  label="avoid hallucinated prompts",