"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/
Python
fix: improve compare output and predict run_id extraction
=36be153887fb
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.pyindex b7f835c46..1497ec837 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@@ -637,6 +637,9 @@ def models_compare(ctx, run_id_1, run_id_2):v2_str = str(v2) if v2 is not None else "N/A"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()diff --git a/unimol_tools/agent-harness/demo_real_examples.sh b/unimol_tools/agent-harness/demo_real_examples.shindex ad53a0b9e..1a1c67c89 100755--- a/unimol_tools/agent-harness/demo_real_examples.sh+++ b/unimol_tools/agent-harness/demo_real_examples.sh@@ -318,6 +318,14 @@ 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@@ -331,8 +339,24 @@ success "Model comparison completed"section "🔮 Bonus: Prediction with Best Model"info "Making predictions on test set using best model..."-# Get best model run_id (assuming it's the one with best metrics)-BEST_RUN=$(python -m cli_anything.unimol_tools -p "$PROJECT_JSON" models best --json 2>/dev/null | grep -o '"run_id":"[^"]*"' | head -1 | cut -d'"' -f4 || echo "run_003")+# Get best model run_id using Python to properly parse JSON+BEST_RUN=$(python3 -c "+import json+import sys+try:+ import subprocess+ result = subprocess.run(+ ['python', '-m', 'cli_anything.unimol_tools', '-p', '$PROJECT_JSON', 'models', 'best', '--json'],+ capture_output=True, text=True, check=True+ )+ data = json.loads(result.stdout)+ print(data.get('run_id', 'run_001'))+except Exception as e:+ print('run_001', file=sys.stderr)+ print('run_001')+" 2>/dev/null || echo "run_001")++echo "Using model: $BEST_RUN"python -m cli_anything.unimol_tools \-p "$PROJECT_JSON" \