Spaces:
Sleeping
Sleeping
Commit
·
54880b1
1
Parent(s):
d6f9002
Add debug logging for model loading and generation issues
Browse files
app.py
CHANGED
|
@@ -581,7 +581,9 @@ def _generate_router_plan_streaming_internal(
|
|
| 581 |
tags=tags,
|
| 582 |
)
|
| 583 |
|
|
|
|
| 584 |
generator = load_pipeline(model_choice)
|
|
|
|
| 585 |
|
| 586 |
# Check if using vLLM or Transformers
|
| 587 |
is_vllm = VLLM_AVAILABLE and isinstance(generator, LLM)
|
|
@@ -714,7 +716,12 @@ def _generate_router_plan_streaming_internal(
|
|
| 714 |
thread.join()
|
| 715 |
|
| 716 |
completion = trim_at_stop_sequences(completion.strip())[0]
|
| 717 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 718 |
try:
|
| 719 |
json_block = extract_json_from_text(completion)
|
| 720 |
parsed_plan = json.loads(json_block)
|
|
@@ -723,10 +730,14 @@ def _generate_router_plan_streaming_internal(
|
|
| 723 |
except Exception as exc:
|
| 724 |
parsed_plan = {}
|
| 725 |
validation_msg = f"❌ JSON parsing failed: {exc}"
|
|
|
|
| 726 |
|
| 727 |
yield completion, parsed_plan, validation_msg, prompt
|
| 728 |
|
| 729 |
except Exception as exc:
|
|
|
|
|
|
|
|
|
|
| 730 |
error_msg = f"❌ Generation failed: {str(exc)}"
|
| 731 |
yield "", {}, error_msg, ""
|
| 732 |
|
|
|
|
| 581 |
tags=tags,
|
| 582 |
)
|
| 583 |
|
| 584 |
+
print(f"[DEBUG] Loading model: {model_choice}")
|
| 585 |
generator = load_pipeline(model_choice)
|
| 586 |
+
print(f"[DEBUG] Model loaded successfully: {type(generator)}")
|
| 587 |
|
| 588 |
# Check if using vLLM or Transformers
|
| 589 |
is_vllm = VLLM_AVAILABLE and isinstance(generator, LLM)
|
|
|
|
| 716 |
thread.join()
|
| 717 |
|
| 718 |
completion = trim_at_stop_sequences(completion.strip())[0]
|
| 719 |
+
print(f"[DEBUG] Final completion length: {len(completion)}")
|
| 720 |
+
|
| 721 |
+
if not completion:
|
| 722 |
+
print("[DEBUG] WARNING: Completion is empty - model may not have generated output")
|
| 723 |
+
validation_msg = "⚠️ Model generated empty output. Check GPU allocation and model loading."
|
| 724 |
+
elif parsed_plan is None:
|
| 725 |
try:
|
| 726 |
json_block = extract_json_from_text(completion)
|
| 727 |
parsed_plan = json.loads(json_block)
|
|
|
|
| 730 |
except Exception as exc:
|
| 731 |
parsed_plan = {}
|
| 732 |
validation_msg = f"❌ JSON parsing failed: {exc}"
|
| 733 |
+
print(f"[DEBUG] JSON parsing error: {exc}")
|
| 734 |
|
| 735 |
yield completion, parsed_plan, validation_msg, prompt
|
| 736 |
|
| 737 |
except Exception as exc:
|
| 738 |
+
import traceback
|
| 739 |
+
print(f"[DEBUG] Exception in generation: {exc}")
|
| 740 |
+
print(f"[DEBUG] Traceback: {traceback.format_exc()}")
|
| 741 |
error_msg = f"❌ Generation failed: {str(exc)}"
|
| 742 |
yield "", {}, error_msg, ""
|
| 743 |
|