mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 06:56:34 +00:00
142c6c4de8
- Replaced module-level path variables in constants.py with a structured Pydantic Config class. - Updated all relevant modules (train.py, augmentation.py, exports.py, dataset-visualiser.py, manual_run.py) to access paths through the new config structure. - Fixed bugs related to image processing and model saving. - Enhanced test infrastructure to accommodate the new configuration approach. This refactor improves code maintainability and clarity by centralizing configuration management.
65 lines
1.9 KiB
Bash
Executable File
65 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
set -euo pipefail
|
||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||
RESULTS_DIR="$PROJECT_ROOT/test-results"
|
||
|
||
cleanup() {
|
||
if [ -d "$RESULTS_DIR" ]; then
|
||
echo "Results saved to $RESULTS_DIR"
|
||
fi
|
||
}
|
||
trap cleanup EXIT
|
||
|
||
mkdir -p "$RESULTS_DIR"
|
||
|
||
echo "════════════════════════════════════"
|
||
echo " Performance Tests"
|
||
echo "════════════════════════════════════"
|
||
echo ""
|
||
echo "Thresholds (from test spec):"
|
||
echo " PT-AUG-01 Augmentation 10 images ≤ 60s"
|
||
echo " PT-AUG-02 Parallel speedup ≥ 1.5×"
|
||
echo " PT-DSF-01 Dataset formation 100 img ≤ 30s"
|
||
echo " PT-ENC-01 Encrypt/decrypt 10MB ≤ 5s"
|
||
echo " PT-INF-01 ONNX inference single ≤ 10s"
|
||
echo ""
|
||
|
||
cd "$PROJECT_ROOT"
|
||
|
||
FAILED=0
|
||
|
||
if python -m pytest tests/performance/ \
|
||
--tb=short \
|
||
--junitxml="$RESULTS_DIR/performance-results.xml" \
|
||
-v; then
|
||
echo ""
|
||
echo "✓ All performance thresholds met"
|
||
else
|
||
echo ""
|
||
echo "✗ Some performance thresholds exceeded"
|
||
FAILED=1
|
||
fi
|
||
|
||
echo ""
|
||
echo "════════════════════════════════════"
|
||
echo " Summary"
|
||
echo "════════════════════════════════════"
|
||
|
||
if [ -f "$RESULTS_DIR/performance-results.xml" ]; then
|
||
python -c "
|
||
import xml.etree.ElementTree as ET
|
||
t = ET.parse('$RESULTS_DIR/performance-results.xml').getroot()
|
||
print(f\"Tests: {t.get('tests',0)} Failures: {t.get('failures',0)} Errors: {t.get('errors',0)}\")
|
||
" 2>/dev/null || echo "Could not parse performance results XML"
|
||
fi
|
||
|
||
if [ $FAILED -ne 0 ]; then
|
||
echo "EXIT: 1 (thresholds exceeded)"
|
||
exit 1
|
||
fi
|
||
|
||
echo "EXIT: 0 (all thresholds met)"
|
||
exit 0
|