lamhieu commited on
Commit
e1525a9
·
1 Parent(s): 62b5b53

chore: allow set samples to zero

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -314,11 +314,16 @@ def generate(
314
  streamer=streamer,
315
  max_new_tokens=max_new_tokens,
316
  do_sample=True,
317
- top_p=top_p,
318
- top_k=top_k,
319
  temperature=temperature,
320
  repetition_penalty=repetition_penalty,
321
  )
 
 
 
 
 
 
 
322
  t = Thread(target=model.generate, kwargs=generate_kwargs)
323
  t.start()
324
 
@@ -345,7 +350,7 @@ chat_interface = gr.ChatInterface(
345
  ),
346
  gr.Slider(
347
  label="Temperature",
348
- minimum=0.1,
349
  maximum=2.0,
350
  step=0.1,
351
  value=0.4,
 
314
  streamer=streamer,
315
  max_new_tokens=max_new_tokens,
316
  do_sample=True,
 
 
317
  temperature=temperature,
318
  repetition_penalty=repetition_penalty,
319
  )
320
+ if temperature == 0:
321
+ generate_kwargs["do_sample"] = False
322
+ else:
323
+ generate_kwargs["temperature"] = temperature
324
+ generate_kwargs["top_p"] = top_p
325
+ generate_kwargs["top_k"] = top_k
326
+
327
  t = Thread(target=model.generate, kwargs=generate_kwargs)
328
  t.start()
329
 
 
350
  ),
351
  gr.Slider(
352
  label="Temperature",
353
+ minimum=0.0,
354
  maximum=2.0,
355
  step=0.1,
356
  value=0.4,