File size: 1,791 Bytes
7c58f51 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# Setup Guide for Phase 4 Testing
## Quick Start
1. **Clone the repository:**
```bash
git clone https://huggingface.co/jmurray10/phase4-quantum-compression
cd phase4-quantum-compression
```
2. **Install dependencies:**
```bash
pip install -r requirements.txt
```
3. **Test compressed models:**
```python
import torch
# Load compressed model
model = torch.load('models/mlp_compressed_int8.pth')
print(f"Model loaded successfully!")
# Test inference
test_input = torch.randn(1, 784)
output = model(test_input)
print(f"Output shape: {output.shape}")
```
4. **Run validation tests:**
```bash
python tests/test_saved_models.py
python tests/test_compressed_model_usability.py
```
## Available Models
| Model | Type | Size | Path |
|-------|------|------|------|
| MLP Original | FP32 | 943KB | `models/mlp_original_fp32.pth` |
| MLP Compressed | INT8 | 241KB | `models/mlp_compressed_int8.pth` |
| CNN Original | FP32 | 1.69MB | `models/cnn_original_fp32.pth` |
| CNN Compressed | INT8 | 483KB | `models/cnn_compressed_int8.pth` |
## Running Quantum Experiments
```python
# Example: Run Grover's algorithm
from src.quantum.qiskit.grover_aer import run_grover_experiment
result = run_grover_experiment(n_qubits=3, marked_state=5)
print(f"Success probability: {result['success_rate']:.3f}")
```
## Energy Measurement
```python
# Example: Measure model energy consumption
from src.energy.energy_logger_nvml import EnergyLogger
logger = EnergyLogger()
energy = logger.measure_inference_energy(model, test_data)
print(f"Energy consumed: {energy:.2f} J")
```
## Reproducing Results
All results can be reproduced by running the scripts in the `src/` directory.
No hardcoded values - everything is computed at runtime!
|