Spaces:
Sleeping
Sleeping
Nu Appleblossom
commited on
Commit
·
f6417bb
1
Parent(s):
5e74cc6
updated requirements and application
Browse files- app.py +4 -0
- requirements.txt +1 -0
app.py
CHANGED
@@ -55,6 +55,7 @@ def load_tokenizer_and_model():
|
|
55 |
logger.error(f"Error loading model or tokenizer: {str(e)}")
|
56 |
return None, None
|
57 |
|
|
|
58 |
def get_embeddings(model):
|
59 |
return model.get_input_embeddings().weight.data
|
60 |
|
@@ -186,6 +187,9 @@ def generate_definition_tree_placeholder(selected_sae, feature_number, weight_ty
|
|
186 |
|
187 |
def gradio_interface():
|
188 |
model, tokenizer = load_tokenizer_and_model()
|
|
|
|
|
|
|
189 |
embeddings = get_embeddings(model)
|
190 |
|
191 |
with gr.Blocks() as demo:
|
|
|
55 |
logger.error(f"Error loading model or tokenizer: {str(e)}")
|
56 |
return None, None
|
57 |
|
58 |
+
|
59 |
def get_embeddings(model):
|
60 |
return model.get_input_embeddings().weight.data
|
61 |
|
|
|
187 |
|
188 |
def gradio_interface():
|
189 |
model, tokenizer = load_tokenizer_and_model()
|
190 |
+
if model is None or tokenizer is None:
|
191 |
+
return gr.Interface(lambda: "Failed to load model and tokenizer. Please check the logs for more details.", inputs=[], outputs="text")
|
192 |
+
|
193 |
embeddings = get_embeddings(model)
|
194 |
|
195 |
with gr.Blocks() as demo:
|
requirements.txt
CHANGED
@@ -11,3 +11,4 @@ matplotlib
|
|
11 |
spaces
|
12 |
graphviz
|
13 |
Pillow
|
|
|
|
11 |
spaces
|
12 |
graphviz
|
13 |
Pillow
|
14 |
+
accelerate
|