Spaces:
Paused
Paused
Robin Genolet
commited on
Commit
·
664ba56
1
Parent(s):
4ac6668
fix: memoization
Browse files
utils/epfl_meditron_utils.py
CHANGED
|
@@ -13,9 +13,11 @@ loaded_model = None
|
|
| 13 |
loaded_model_name = ""
|
| 14 |
|
| 15 |
def get_llm_response(model_name_or_path, temperature, do_sample, top_p, top_k, max_new_tokens, repetition_penalty, formatted_prompt):
|
|
|
|
|
|
|
|
|
|
| 16 |
if loaded_model != model_name_or_path:
|
| 17 |
-
|
| 18 |
-
global loaded_model_name
|
| 19 |
loaded_model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
|
| 20 |
device_map="auto",
|
| 21 |
trust_remote_code=False,
|
|
|
|
| 13 |
loaded_model_name = ""
|
| 14 |
|
| 15 |
def get_llm_response(model_name_or_path, temperature, do_sample, top_p, top_k, max_new_tokens, repetition_penalty, formatted_prompt):
|
| 16 |
+
global loaded_model
|
| 17 |
+
global loaded_model_name
|
| 18 |
+
|
| 19 |
if loaded_model != model_name_or_path:
|
| 20 |
+
|
|
|
|
| 21 |
loaded_model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
|
| 22 |
device_map="auto",
|
| 23 |
trust_remote_code=False,
|