Spaces:
Sleeping
Sleeping
Nu Appleblossom
commited on
Commit
·
a7918a7
1
Parent(s):
6510302
back to last promising version with treebuild crashlog, revising whole tree gen thing with Claude 7
Browse files
app.py
CHANGED
@@ -535,10 +535,10 @@ def gradio_interface():
|
|
535 |
tree_generator = generate_definition_tree(base_prompt, feature_vector, model, tokenizer, config)
|
536 |
|
537 |
log_output = []
|
|
|
538 |
for item in tree_generator:
|
539 |
if isinstance(item, str):
|
540 |
log_output.append(item)
|
541 |
-
yield item, None
|
542 |
else:
|
543 |
tree_data = item
|
544 |
|
@@ -547,10 +547,10 @@ def gradio_interface():
|
|
547 |
max_weight, min_weight = find_max_min_cumulative_weight(tree_data)
|
548 |
tree_image = create_tree_diagram(tree_data, config, max_weight, min_weight)
|
549 |
logger.info("Tree image generated successfully")
|
550 |
-
|
551 |
else:
|
552 |
logger.error("Failed to generate tree data")
|
553 |
-
|
554 |
|
555 |
return "Mode not recognized or not implemented in this step.", None
|
556 |
|
@@ -627,7 +627,7 @@ def gradio_interface():
|
|
627 |
inputs=[selected_sae, feature_number, weight_type, use_token_centroid, scaling_factor, use_pca, pca_weight, num_exp, denom_exp, mode],
|
628 |
outputs=[output_stream, output_image],
|
629 |
show_progress="full"
|
630 |
-
)
|
631 |
|
632 |
generate_top_500_btn.click(
|
633 |
generate_top_500,
|
|
|
535 |
tree_generator = generate_definition_tree(base_prompt, feature_vector, model, tokenizer, config)
|
536 |
|
537 |
log_output = []
|
538 |
+
tree_data = None
|
539 |
for item in tree_generator:
|
540 |
if isinstance(item, str):
|
541 |
log_output.append(item)
|
|
|
542 |
else:
|
543 |
tree_data = item
|
544 |
|
|
|
547 |
max_weight, min_weight = find_max_min_cumulative_weight(tree_data)
|
548 |
tree_image = create_tree_diagram(tree_data, config, max_weight, min_weight)
|
549 |
logger.info("Tree image generated successfully")
|
550 |
+
return "\n".join(log_output), tree_image
|
551 |
else:
|
552 |
logger.error("Failed to generate tree data")
|
553 |
+
return "Error: Failed to generate tree data.", None
|
554 |
|
555 |
return "Mode not recognized or not implemented in this step.", None
|
556 |
|
|
|
627 |
inputs=[selected_sae, feature_number, weight_type, use_token_centroid, scaling_factor, use_pca, pca_weight, num_exp, denom_exp, mode],
|
628 |
outputs=[output_stream, output_image],
|
629 |
show_progress="full"
|
630 |
+
)
|
631 |
|
632 |
generate_top_500_btn.click(
|
633 |
generate_top_500,
|