| 191 | |
| 192 | |
| 193 | def prepare_generation_config(): |
| 194 | with st.sidebar: |
| 195 | max_length = st.slider('Max Length', |
| 196 | min_value=8, |
| 197 | max_value=32768, |
| 198 | value=32768) |
| 199 | top_p = st.slider('Top P', 0.0, 1.0, 0.8, step=0.01) |
| 200 | temperature = st.slider('Temperature', 0.0, 1.0, 0.7, step=0.01) |
| 201 | st.button('Clear Chat History', on_click=on_btn_click) |
| 202 | |
| 203 | generation_config = GenerationConfig(max_length=max_length, |
| 204 | top_p=top_p, |
| 205 | temperature=temperature) |
| 206 | |
| 207 | return generation_config |
| 208 | |
| 209 | |
| 210 | user_prompt = '<|im_start|>user\n{user}<|im_end|>\n' |