PhantHive commited on
Commit
a1ecb77
1 Parent(s): dec6f51

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
- from peft import PeftModel, PeftConfig
 
3
  from transformers import AutoModelForCausalLM, AutoTokenizer
4
  import torch
5
 
@@ -20,7 +21,7 @@ def greet(text):
20
 
21
  # Use torch.no_grad to disable gradient calculation
22
  with torch.no_grad():
23
- output_tokens = model.generate(**batch, max_new_tokens=15)
24
 
25
  return tokenizer.decode(output_tokens[0], skip_special_tokens=True)
26
 
 
1
  import gradio as gr
2
+ from peft import PeftModel
3
+ , PeftConfig
4
  from transformers import AutoModelForCausalLM, AutoTokenizer
5
  import torch
6
 
 
21
 
22
  # Use torch.no_grad to disable gradient calculation
23
  with torch.no_grad():
24
+ output_tokens = model.generate(**batch, do_sample=True, max_new_tokens=15)
25
 
26
  return tokenizer.decode(output_tokens[0], skip_special_tokens=True)
27