Aakash Vardhan commited on
Commit
5a78843
·
1 Parent(s): 5bf6450
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -37,9 +37,9 @@ def respond(
37
  message,
38
  history,
39
  system_message,
40
- max_tokens= 256,
41
- temperature= 0.3,
42
- top_p= 0.95,
43
  ):
44
  # Construct the chat list
45
  chat_list = [{"role": "system", "content": system_message}]
@@ -65,10 +65,13 @@ def respond(
65
  # Adjust max_length to be greater than input_length
66
  max_length = input_length + max_tokens
67
 
 
 
 
68
  outputs = pipe(
69
  prompt,
70
- max_new_tokens=max_tokens,
71
- max_length=max_length, # Add this line
72
  num_beams=1,
73
  do_sample=True,
74
  temperature=temperature,
@@ -97,7 +100,7 @@ demo = gr.ChatInterface(
97
  value="You are General Knowledge Assistant. Answer the questions based on the provided information. Be succinct and use first-principles thinking to answer the questions.",
98
  label="System message",
99
  ),
100
- gr.Slider(minimum=1, maximum=2048, value=256, step=1, label="Max new tokens"),
101
  gr.Slider(minimum=0.1, maximum=2.0, value=0.3, step=0.1, label="Temperature"),
102
  gr.Slider(
103
  minimum=0.1,
 
37
  message,
38
  history,
39
  system_message,
40
+ max_tokens=256,
41
+ temperature=0.3,
42
+ top_p=0.95,
43
  ):
44
  # Construct the chat list
45
  chat_list = [{"role": "system", "content": system_message}]
 
65
  # Adjust max_length to be greater than input_length
66
  max_length = input_length + max_tokens
67
 
68
+ # Ensure max_length is an integer
69
+ max_length = int(max_length)
70
+
71
  outputs = pipe(
72
  prompt,
73
+ max_new_tokens=int(max_tokens), # Ensure this is an integer
74
+ max_length=max_length,
75
  num_beams=1,
76
  do_sample=True,
77
  temperature=temperature,
 
100
  value="You are General Knowledge Assistant. Answer the questions based on the provided information. Be succinct and use first-principles thinking to answer the questions.",
101
  label="System message",
102
  ),
103
+ gr.Slider(minimum=1, maximum=2048, value=256, step=1, label="Max new tokens", dtype=int),
104
  gr.Slider(minimum=0.1, maximum=2.0, value=0.3, step=0.1, label="Temperature"),
105
  gr.Slider(
106
  minimum=0.1,