phase4-quantum-compression / SETUP_GUIDE.md
jmurray10's picture
Add test scripts, requirements, and setup guide for users
7c58f51 verified

Setup Guide for Phase 4 Testing

Quick Start

  1. Clone the repository:
git clone https://huggingface.co/jmurray10/phase4-quantum-compression
cd phase4-quantum-compression
  1. Install dependencies:
pip install -r requirements.txt
  1. Test compressed models:
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}")
  1. Run validation tests:
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

# 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

# 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!