Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	make temperature fixed to 0.1
Browse files
    	
        app.py
    CHANGED
    
    | @@ -196,7 +196,6 @@ with gr.Blocks(css=CSS, theme="soft") as demo: | |
| 196 |  | 
| 197 | 
             
                # Parameters in accordion similar to second code
         | 
| 198 | 
             
                with gr.Accordion("⚙️ Parameters", open=False, elem_classes="accordion"):
         | 
| 199 | 
            -
                    temperature = gr.Slider(minimum=0, maximum=1, value=0.1, step=0.05, label="Temperature", info="Higher values produce more diverse outputs")
         | 
| 200 | 
             
                    max_new_tokens = gr.Slider(minimum=64, maximum=4096*8, value=1024, step=64, label="Max new tokens", info="Maximum length of generated response")
         | 
| 201 | 
             
                    top_p = gr.Slider(minimum=0, maximum=1, value=1.0, step=0.05, label="top_p", info="1.0 means no filtering")
         | 
| 202 | 
             
                    top_k = gr.Slider(minimum=1, maximum=20, step=1, value=20, label="top_k")
         | 
| @@ -216,7 +215,8 @@ with gr.Blocks(css=CSS, theme="soft") as demo: | |
| 216 | 
             
                def user(user_message, history):
         | 
| 217 | 
             
                    return "", history + [[user_message, None]]
         | 
| 218 |  | 
| 219 | 
            -
                def bot(history, model_choice,  | 
|  | |
| 220 | 
             
                    user_message = history[-1][0]
         | 
| 221 | 
             
                    history[-1][1] = ""
         | 
| 222 | 
             
                    for character in stream_chat(
         | 
| @@ -234,10 +234,10 @@ with gr.Blocks(css=CSS, theme="soft") as demo: | |
| 234 |  | 
| 235 | 
             
                # Set up event handlers
         | 
| 236 | 
             
                msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
         | 
| 237 | 
            -
                    bot, [chatbot, model_dropdown,  | 
| 238 | 
             
                )
         | 
| 239 | 
             
                submit_btn.click(user, [msg, chatbot], [msg, chatbot], queue=False).then(
         | 
| 240 | 
            -
                    bot, [chatbot, model_dropdown,  | 
| 241 | 
             
                )
         | 
| 242 |  | 
| 243 | 
             
            if __name__ == "__main__":
         | 
|  | |
| 196 |  | 
| 197 | 
             
                # Parameters in accordion similar to second code
         | 
| 198 | 
             
                with gr.Accordion("⚙️ Parameters", open=False, elem_classes="accordion"):
         | 
|  | |
| 199 | 
             
                    max_new_tokens = gr.Slider(minimum=64, maximum=4096*8, value=1024, step=64, label="Max new tokens", info="Maximum length of generated response")
         | 
| 200 | 
             
                    top_p = gr.Slider(minimum=0, maximum=1, value=1.0, step=0.05, label="top_p", info="1.0 means no filtering")
         | 
| 201 | 
             
                    top_k = gr.Slider(minimum=1, maximum=20, step=1, value=20, label="top_k")
         | 
|  | |
| 215 | 
             
                def user(user_message, history):
         | 
| 216 | 
             
                    return "", history + [[user_message, None]]
         | 
| 217 |  | 
| 218 | 
            +
                def bot(history, model_choice, max_tokens, top_p_val, top_k_val, penalty):
         | 
| 219 | 
            +
                    temp = 0.1
         | 
| 220 | 
             
                    user_message = history[-1][0]
         | 
| 221 | 
             
                    history[-1][1] = ""
         | 
| 222 | 
             
                    for character in stream_chat(
         | 
|  | |
| 234 |  | 
| 235 | 
             
                # Set up event handlers
         | 
| 236 | 
             
                msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
         | 
| 237 | 
            +
                    bot, [chatbot, model_dropdown, max_new_tokens, top_p, top_k, presence_penalty], chatbot
         | 
| 238 | 
             
                )
         | 
| 239 | 
             
                submit_btn.click(user, [msg, chatbot], [msg, chatbot], queue=False).then(
         | 
| 240 | 
            +
                    bot, [chatbot, model_dropdown, max_new_tokens, top_p, top_k, presence_penalty], chatbot
         | 
| 241 | 
             
                )
         | 
| 242 |  | 
| 243 | 
             
            if __name__ == "__main__":
         | 

