Skip to content

Commit edb9e21

Browse files
committed
Update uv.lock: Adjust revision and package specifications
- Changed revision from 3 to 2. - Added conditional specifications for 'pennylane' and 'pennylane-lightning' for Python 3.11 and above. - Included 'scipy' with a minimum version of 1.11.
1 parent 2f537ab commit edb9e21

File tree

6 files changed

+1488
-51
lines changed

6 files changed

+1488
-51
lines changed

qdp/qdp-python/benchmark/encoding_benchmarks/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,74 @@ uv run python benchmark/encoding_benchmarks/qdp_pipeline/mnist_amplitude.py \
117117
--digits "3,6" --n-samples 100 --trials 3 --iters 500 --early-stop 0
118118
```
119119

120+
## SVHN IQP baseline (pure PennyLane)
121+
122+
Pipeline: 2-class SVHN (digit 1 vs 7) → PCA (3072 → n_qubits) → custom IQP circuit (H^n · Diag · H^n) → variational classifier.
123+
124+
```bash
125+
uv run python benchmark/encoding_benchmarks/pennylane_baseline/svhn_iqp.py
126+
```
127+
128+
Common flags (only the key ones):
129+
130+
- `--n-qubits`: number of qubits / PCA components (default: 10)
131+
- `--n-samples`: total samples after binary filter + subsample (default: 500)
132+
- `--iters`: optimizer steps (default: 500)
133+
- `--batch-size`: batch size (default: 10)
134+
- `--layers`: number of variational layers (default: 6)
135+
- `--lr`: learning rate (default: 0.01)
136+
- `--optimizer`: `adam` or `nesterov` (default: `adam`)
137+
- `--trials`: number of restarts; best test accuracy reported (default: 3)
138+
- `--early-stop`: stop when test accuracy >= this; 0 = off (default: 0.85)
139+
- `--backend`: `cpu` (default.qubit) or `gpu` (lightning.gpu)
140+
141+
Example (quick test):
142+
143+
```bash
144+
uv run python benchmark/encoding_benchmarks/pennylane_baseline/svhn_iqp.py \
145+
--n-qubits 6 --n-samples 200 --iters 200 --trials 1 --early-stop 0 --backend cpu
146+
```
147+
148+
## SVHN IQP (QDP pipeline)
149+
150+
Pipeline is identical to the baseline except for encoding:
151+
PCA-reduced vectors → QDP `QdpEngine.encode(method="iqp")` (one-shot, GPU) → `StatePrep(state_vector)` → same variational classifier.
152+
153+
```bash
154+
uv run python benchmark/encoding_benchmarks/qdp_pipeline/svhn_iqp.py
155+
```
156+
157+
The CLI mirrors the baseline, plus:
158+
159+
- **QDP-specific flags**
160+
- `--device-id`: CUDA device id (default: 0)
161+
162+
Example (same settings as the baseline example, but with QDP encoding):
163+
164+
```bash
165+
uv run python benchmark/encoding_benchmarks/qdp_pipeline/svhn_iqp.py \
166+
--n-qubits 6 --n-samples 200 --iters 200 --trials 1 --early-stop 0 --backend cpu
167+
```
168+
169+
## SVHN IQP experiment runner
170+
171+
Run all qubit-scaling, accuracy-parity, and sample-scaling experiments:
172+
173+
```bash
174+
bash benchmark/encoding_benchmarks/run_svhn_iqp_experiments.sh
175+
```
176+
177+
Logs are saved to `benchmark/encoding_benchmarks/logs/`. Results and analysis are in `benchmark/encoding_benchmarks/report.md`.
178+
120179
## Full help
121180

122181
To see the full list of options and defaults, append `--help`:
123182

124183
```bash
125184
uv run python benchmark/encoding_benchmarks/pennylane_baseline/iris_amplitude.py --help
126185
uv run python benchmark/encoding_benchmarks/pennylane_baseline/mnist_amplitude.py --help
186+
uv run python benchmark/encoding_benchmarks/pennylane_baseline/svhn_iqp.py --help
127187
uv run python benchmark/encoding_benchmarks/qdp_pipeline/iris_amplitude.py --help
128188
uv run python benchmark/encoding_benchmarks/qdp_pipeline/mnist_amplitude.py --help
189+
uv run python benchmark/encoding_benchmarks/qdp_pipeline/svhn_iqp.py --help
129190
```

0 commit comments

Comments
 (0)