| 174 | |
| 175 | |
| 176 | def prepare_generation_config(): |
| 177 | with st.sidebar: |
| 178 | max_length = st.slider('Max Length', |
| 179 | min_value=8, |
| 180 | max_value=32768, |
| 181 | value=2048) |
| 182 | top_p = st.slider('Top P', 0.0, 1.0, 0.75, step=0.01) |
| 183 | temperature = st.slider('Temperature', 0.0, 1.0, 0.1, step=0.01) |
| 184 | st.button('Clear Chat History', on_click=on_btn_click) |
| 185 | |
| 186 | generation_config = GenerationConfig(max_length=max_length, |
| 187 | top_p=top_p, |
| 188 | temperature=temperature) |
| 189 | |
| 190 | return generation_config |
| 191 | |
| 192 | |
| 193 | user_prompt = '<|im_start|>user\n{user}<|im_end|>\n' |