Tonic commited on
Commit
c06f586
Β·
1 Parent(s): f506d75

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -33,14 +33,19 @@ class ChatBot:
33
  # Generate a response using the model
34
  tokens = model.generate(
35
  inputs.to(model.device),
36
- max_new_tokens=1024,
37
  temperature=0.8,
38
- do_sample=True
39
  )
40
 
41
  # Decode and return the response
42
  response_text = tokenizer.decode(tokens[0], skip_special_tokens=False)
43
  return response_text
 
 
 
 
 
44
 
45
  bot = ChatBot()
46
 
 
33
  # Generate a response using the model
34
  tokens = model.generate(
35
  inputs.to(model.device),
36
+ max_new_tokens=250,
37
  temperature=0.8,
38
+ do_sample=False
39
  )
40
 
41
  # Decode and return the response
42
  response_text = tokenizer.decode(tokens[0], skip_special_tokens=False)
43
  return response_text
44
+
45
+ # Free up memory
46
+ del tokens
47
+ torch.cuda.empty_cache()
48
+ return response_text
49
 
50
  bot = ChatBot()
51