Update app.py
Browse files
app.py
CHANGED
@@ -60,7 +60,7 @@ def reset_model(model_name, *extra_components, with_extra_components=True):
|
|
60 |
AutoModelClass = CAutoModelForCausalLM if use_ctransformers else AutoModelForCausalLM
|
61 |
|
62 |
# get model
|
63 |
-
global_state.model, global_state.tokenizer, global_state.local_state = None, None,
|
64 |
gc.collect()
|
65 |
global_state.model = AutoModelClass.from_pretrained(model_path, **model_args)
|
66 |
if not dont_cuda:
|
@@ -227,7 +227,7 @@ with gr.Blocks(theme=gr.themes.Default(), css='styles.css') as demo:
|
|
227 |
], [progress_dummy, *interpretation_bubbles])
|
228 |
|
229 |
original_prompt_btn.click(get_hidden_states,
|
230 |
-
[gr.State(global_state), original_prompt_raw],
|
231 |
[progress_dummy, *tokens_container, *interpretation_bubbles])
|
232 |
original_prompt_raw.change(lambda: [gr.Button(visible=False) for _ in range(MAX_PROMPT_TOKENS)], [], tokens_container)
|
233 |
|
|
|
60 |
AutoModelClass = CAutoModelForCausalLM if use_ctransformers else AutoModelForCausalLM
|
61 |
|
62 |
# get model
|
63 |
+
global_state.model, global_state.tokenizer, global_state.local_state.hidden_states = None, None, None
|
64 |
gc.collect()
|
65 |
global_state.model = AutoModelClass.from_pretrained(model_path, **model_args)
|
66 |
if not dont_cuda:
|
|
|
227 |
], [progress_dummy, *interpretation_bubbles])
|
228 |
|
229 |
original_prompt_btn.click(get_hidden_states,
|
230 |
+
[gr.State(global_state.local_state), original_prompt_raw],
|
231 |
[progress_dummy, *tokens_container, *interpretation_bubbles])
|
232 |
original_prompt_raw.change(lambda: [gr.Button(visible=False) for _ in range(MAX_PROMPT_TOKENS)], [], tokens_container)
|
233 |
|