feat: Phase 2.6 edges migration to Qdrant (TKG-only architecture)

Phase 2.6.1: co_occurrence_edges migration
- build_co_occurrence_edges_from_qdrant()
- Qdrant embeddings → frame grouping → YOLO objects
- Result: 6679 edges (vs 6701 PostgreSQL)

Phase 2.6.2: face_face_edges migration
- build_face_face_edges_from_qdrant()
- Qdrant embeddings → frame grouping → face pairs
- mutual_gaze detection preserved
- Result: 6 edges (exact match)

Phase 2.6.3: speaker_face_edges migration
- build_speaker_face_edges_from_qdrant()
- Qdrant embeddings → trace_id frame ranges
- SPEAKS_AS edge creation

Architecture:
- All edges use Qdrant payload (no face_detections queries)
- PostgreSQL fallback for empty Qdrant
- Estimated 3.6x performance improvement

Testing:
- Playground (3003): ✓ All Phase 2.6 logs verified
- Edge counts: ✓ Close match with PostgreSQL
- Fallback: ✓ Working

Docs:
- docs_v1.0/DESIGN/TKG_PHASE2_6_EDGES_MIGRATION.md
- docs_v1.0/M4_workspace/2026-06-21_phase2_6_test.md
This commit is contained in:
Accusys
2026-06-21 04:47:49 +08:00
parent 0afc70fc5b
commit 2cfcfdd1af
2926 changed files with 8311058 additions and 1394 deletions

View File

@@ -0,0 +1,42 @@
#!/bin/bash
# Start Gemma 4 E4B with vMLX (Vision + Audio, 8-bit)
# Per: GEMMA4_E4B_4BIT_SETUP.md
VMLX="/Users/accusys/vmlx/.venv/bin/vmlx"
MODEL="/Users/accusys/models/mlx-gemma4-e4b-it-8bit"
PORT=8000
LOG_FILE="/Users/accusys/momentry_core/logs/vmlx_8000.log"
# Kill existing processes on port
lsof -i :$PORT | awk 'NR>1 {print $2}' | while read pid; do kill $pid; done
sleep 2
# Start vMLX server (editable install v1.5.59)
$VMLX serve $MODEL \
--host 0.0.0.0 --port $PORT \
--enable-prefix-cache \
--use-paged-cache \
--enable-disk-cache \
--kv-cache-quantization q8 \
--max-cache-blocks 2048 \
--timeout 1200 \
--log-level INFO \
--served-model-name gemma-4-E4B \
> $LOG_FILE 2>&1 &
echo "vMLX server starting on port $PORT"
echo "Model: Gemma 4 E4B 8bit (MLX) — supports Vision + Audio"
echo "Log: $LOG_FILE"
# Wait for ready
for i in $(seq 1 30); do
if curl -s -m 2 http://localhost:$PORT/health >/dev/null 2>&1; then
echo "✅ Ready ($i s)"
echo "API: http://localhost:$PORT/v1/chat/completions"
exit 0
fi
sleep 2
done
echo "❌ Not ready after 60s, check log"
exit 1