unsloth/tests/metrics/README.md
Rachel Li 078b76281a Add vLLM-style runtime metrics for inference and training
- Comprehensive metrics collection system (inference + training)
- Prometheus-compatible export with optional HTTP server
- Programmatic access to metrics
- Automatic instrumentation of inference and training loops
- All tests passing
2026-03-12 23:10:55 +00:00

50 lines
1.2 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Metrics Tests
## Running Tests
```bash
python3 tests/metrics/test_metrics_standalone.py
```
## Test Coverage
The test suite verifies:
1. **InferenceStats** - Request tracking, token counts, latencies
2. **TrainingStats** - Batch tracking, loss, throughput
3. **StatsCollector** - Singleton pattern, enable/disable
4. **Prometheus Export** - Client availability check
## Test Results
See `TEST_RESULTS.txt` for the latest test run output.
## Expected Output
```
============================================================
Unsloth Metrics Collection - Standalone Test
============================================================
1. Testing InferenceStats...
✅ Total requests: 1
✅ Prompt tokens: 10
✅ Generation tokens: 5
✅ Avg latency: 0.087s
2. Testing TrainingStats...
✅ Total steps: 3
✅ Total samples: 12
✅ Avg loss: 0.4500
3. Testing StatsCollector...
✅ StatsCollector working
4. Testing Prometheus export...
✅ Prometheus client available
Full Prometheus export test requires GPU environment
============================================================
✅ All metrics tests passed!
============================================================
```