()
| 165 | |
| 166 | @st.cache_resource |
| 167 | def load_model(): |
| 168 | model = (AutoModelForCausalLM.from_pretrained(model_name_or_path, |
| 169 | trust_remote_code=True).to( |
| 170 | torch.bfloat16).cuda()) |
| 171 | tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, |
| 172 | trust_remote_code=True) |
| 173 | return model, tokenizer |
| 174 | |
| 175 | |
| 176 | def prepare_generation_config(): |