Wave 1 (Architecture & Design - 5 agents): - Multi-model training orchestration (DQN, PPO, MAMBA-2, TFT-INT8) - Sequential training strategy (95.9% GPU headroom, 6.3min total) - Hybrid multi-asset strategy (2x parallel, 22% GPU usage, 12-18min) - Backward compatible gRPC API design with oneof pattern - TDD test pyramid (67 tests: 24 unit + 28 integration + 15 E2E) - Implementation roadmap (20 agents, 2.5 weeks, 13,280 LOC) Wave 2 (Core TLI Commands - 5 agents): - tli train start: Multi-model, multi-asset job submission (14 tests ✅) - tli train watch: Real-time streaming with weighted progress (10 tests ✅) - tli train status: Color-coded formatted status display (10 tests ✅) - tli train list: Filtering, sorting, pagination support (12 tests ✅) - tli train stop: Graceful cancellation with checkpoints (11 tests ✅) Status: - 57/57 tests passing (100% TDD compliance) - ~4,095 LOC (tests + implementation + docs) - 3.5 hours actual vs 15-20 hours estimated (78% faster) - Zero compilation errors, production-ready code - Full documentation: WAVE_2_TLI_COMMANDS_COMPLETE.md Next: Wave 3 (Multi-Asset Multi-Model Backend Logic - 5 agents) 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
101 lines
3.1 KiB
Bash
Executable File
101 lines
3.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# File Size Comparison Script for Quantized Checkpoints
|
|
#
|
|
# Compares FP32 vs INT8 checkpoint sizes across all models.
|
|
#
|
|
# Usage:
|
|
# ./ml/scripts/compare_checkpoint_sizes.sh
|
|
|
|
set -e
|
|
|
|
CHECKPOINT_DIR="ml/trained_models"
|
|
|
|
echo "=== Checkpoint Size Comparison (FP32 vs INT8) ==="
|
|
echo ""
|
|
|
|
# Function to get file size in MB
|
|
get_size_mb() {
|
|
local file="$1"
|
|
if [ -f "$file" ]; then
|
|
du -h "$file" | awk '{print $1}'
|
|
else
|
|
echo "N/A"
|
|
fi
|
|
}
|
|
|
|
# Function to calculate percentage reduction
|
|
calc_reduction() {
|
|
local fp32_size="$1"
|
|
local int8_size="$2"
|
|
|
|
if [ "$fp32_size" != "N/A" ] && [ "$int8_size" != "N/A" ]; then
|
|
# Strip units and calculate
|
|
fp32_bytes=$(du -b "$fp32_size" 2>/dev/null | awk '{print $1}')
|
|
int8_bytes=$(du -b "$int8_size" 2>/dev/null | awk '{print $1}')
|
|
|
|
if [ "$fp32_bytes" -gt 0 ]; then
|
|
reduction=$(echo "scale=1; 100 * (1 - $int8_bytes / $fp32_bytes)" | bc)
|
|
echo "${reduction}%"
|
|
else
|
|
echo "N/A"
|
|
fi
|
|
else
|
|
echo "N/A"
|
|
fi
|
|
}
|
|
|
|
echo "Model | FP32 Size | INT8 Size | Reduction"
|
|
echo "---------------|-----------|-----------|----------"
|
|
|
|
# DQN checkpoints
|
|
DQN_FP32="${CHECKPOINT_DIR}/dqn_final_epoch3.safetensors"
|
|
DQN_INT8="${CHECKPOINT_DIR}/dqn_quantized_demo.safetensors"
|
|
|
|
if [ -f "$DQN_FP32" ] || [ -f "$DQN_INT8" ]; then
|
|
fp32_size=$(get_size_mb "$DQN_FP32")
|
|
int8_size=$(get_size_mb "$DQN_INT8")
|
|
echo "DQN | $fp32_size | $int8_size | $(calc_reduction "$DQN_FP32" "$DQN_INT8")"
|
|
fi
|
|
|
|
# PPO checkpoints
|
|
PPO_FP32="${CHECKPOINT_DIR}/ppo_checkpoint_epoch_3.safetensors"
|
|
PPO_INT8="${CHECKPOINT_DIR}/ppo_quantized_epoch_3.safetensors"
|
|
|
|
if [ -f "$PPO_FP32" ] || [ -f "$PPO_INT8" ]; then
|
|
fp32_size=$(get_size_mb "$PPO_FP32")
|
|
int8_size=$(get_size_mb "$PPO_INT8")
|
|
echo "PPO | $fp32_size | $int8_size | $(calc_reduction "$PPO_FP32" "$PPO_INT8")"
|
|
fi
|
|
|
|
# MAMBA-2 checkpoints
|
|
MAMBA_FP32="${CHECKPOINT_DIR}/mamba2_real_data/mamba2_epoch_24.safetensors"
|
|
MAMBA_INT8="${CHECKPOINT_DIR}/mamba2_real_data/mamba2_quantized_epoch_24.safetensors"
|
|
|
|
if [ -f "$MAMBA_FP32" ] || [ -f "$MAMBA_INT8" ]; then
|
|
fp32_size=$(get_size_mb "$MAMBA_FP32")
|
|
int8_size=$(get_size_mb "$MAMBA_INT8")
|
|
echo "MAMBA-2 | $fp32_size | $int8_size | $(calc_reduction "$MAMBA_FP32" "$MAMBA_INT8")"
|
|
fi
|
|
|
|
# TFT checkpoints
|
|
TFT_FP32="${CHECKPOINT_DIR}/tft_225_epoch_0.safetensors"
|
|
TFT_INT8="${CHECKPOINT_DIR}/tft_quantized_225_epoch_0.safetensors"
|
|
|
|
if [ -f "$TFT_FP32" ] || [ -f "$TFT_INT8" ]; then
|
|
fp32_size=$(get_size_mb "$TFT_FP32")
|
|
int8_size=$(get_size_mb "$TFT_INT8")
|
|
echo "TFT | $fp32_size | $int8_size | $(calc_reduction "$TFT_FP32" "$TFT_INT8")"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Legend:"
|
|
echo " FP32 Size: Float32 checkpoint size (original)"
|
|
echo " INT8 Size: Quantized INT8 checkpoint size"
|
|
echo " Reduction: Percentage size reduction (target: ~75%)"
|
|
echo ""
|
|
echo "Target file sizes:"
|
|
echo " DQN: < 50 MB (INT8)"
|
|
echo " PPO: < 75 MB (INT8)"
|
|
echo " MAMBA: < 100 MB (INT8)"
|
|
echo " TFT: < 100 MB (INT8)"
|