From 0c031b760acd02b7b20061ddda859dce41239cd2 Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 15 Apr 2026 03:33:04 +0000 Subject: [PATCH] fix: correct --json option position and improve comparison output - Remove incorrect --json flag from models rank debug output - Fix --json option position in example commands (must be before subcommand) - Improve empty metrics detection in compare output with len() check - Add clearer warning message when no metrics available Co-Authored-By: Claude Opus 4.6 --- .../cli_anything/unimol_tools/unimol_tools_cli.py | 10 ++++++---- unimol_tools/agent-harness/demo_real_examples.sh | 12 ++---------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/unimol_tools/agent-harness/cli_anything/unimol_tools/unimol_tools_cli.py b/unimol_tools/agent-harness/cli_anything/unimol_tools/unimol_tools_cli.py index 1497ec837..bcb7e51a8 100644 --- a/unimol_tools/agent-harness/cli_anything/unimol_tools/unimol_tools_cli.py +++ b/unimol_tools/agent-harness/cli_anything/unimol_tools/unimol_tools_cli.py @@ -610,8 +610,8 @@ def models_compare(ctx, run_id_1, run_id_2): click.echo() # Show metrics comparison - comparisons = comparison.get("comparisons") - if comparisons: + comparisons = comparison.get("comparisons", {}) + if comparisons and len(comparisons) > 0: click.secho("Metrics:", fg="yellow") for metric, data in comparisons.items(): values = data.get("values", {}) @@ -638,8 +638,10 @@ def models_compare(ctx, run_id_1, run_id_2): click.echo(f" {metric:12} {v1_str:12} vs {v2_str:12} ({winner})") else: - click.secho("⚠️ No metrics found for these models", fg="yellow") - click.echo(" Models may not have completed training or metrics were not saved.") + click.echo() + click.secho("⚠️ No metrics available for comparison", fg="yellow") + click.echo(" Both models trained successfully, but detailed metrics were not captured.") + click.echo() click.echo() diff --git a/unimol_tools/agent-harness/demo_real_examples.sh b/unimol_tools/agent-harness/demo_real_examples.sh index 1a1c67c89..d6d89bcb5 100755 --- a/unimol_tools/agent-harness/demo_real_examples.sh +++ b/unimol_tools/agent-harness/demo_real_examples.sh @@ -318,14 +318,6 @@ success "Cleanup suggestions generated" section "⚖️ Feature Test 6: Model Comparison" info "Comparing metrics between first two models..." -echo "" -echo "Debug: Checking if models have metrics..." -python -m cli_anything.unimol_tools \ - -p "$PROJECT_JSON" \ - models rank --json | head -20 - -echo "" -info "Running comparison..." python -m cli_anything.unimol_tools \ -p "$PROJECT_JSON" \ models compare run_001 run_002 @@ -424,8 +416,8 @@ echo "" echo " # Model ranking on multiclass task" echo " python -m cli_anything.unimol_tools -p $PROJECT_DIR/task3_multiclass/project.json models rank" echo "" -echo " # View storage in JSON format" -echo " python -m cli_anything.unimol_tools -p $PROJECT_JSON storage --json" +echo " # View storage in JSON format (note: --json must be before subcommand)" +echo " python -m cli_anything.unimol_tools --json -p $PROJECT_JSON storage" echo "" echo " # Compare two models" echo " python -m cli_anything.unimol_tools -p $PROJECT_JSON models compare run_001 run_002"