-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verifying Example Functionality in GitHub Actions #206
Changes from all commits
a532575
1d7fece
9312337
beef182
12a552a
4565221
83345b4
1637680
60b055f
52391de
53ed825
15bfb8c
34b974c
179cf79
a725b11
43b4712
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: Python package | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install flake8 pytest qiskit-aer qiskit-ibmq-provider | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Test Examples | ||
run: | | ||
python3 examples/qubit_rotation/qubit_rotation.py --epochs 1 | ||
python3 examples/vqe/vqe.py --epochs 1 --steps_per_epoch 1 | ||
python3 examples/train_unitary_prep/train_unitary_prep.py --epochs 1 | ||
python3 examples/train_state_prep/train_state_prep.py --epochs 1 | ||
python3 examples/superdense_coding/superdense_coding_torchquantum.py | ||
python3 examples/regression/run_regression.py --epochs 1 | ||
python3 examples/param_shift_onchip_training/param_shift.py | ||
python3 examples/mnist/mnist_2qubit_4class.py --epochs 1 | ||
python3 examples/hadamard_grad/circ.py | ||
python3 examples/encoder_examples/encoder_8x2ry.py | ||
python3 examples/converter_tq_qiskit/convert.py | ||
python3 examples/amplitude_encoding_mnist/mnist_new.py --epochs 1 | ||
python3 examples/amplitude_encoding_mnist/mnist_example.py --epochs 1 | ||
python3 examples/PauliSumOp/pauli_sum_op.py | ||
python3 examples/regression/new_run_regression.py --epochs 1 | ||
python3 examples/quanvolution/quanvolution_trainable_quantum_layer.py --epochs 1 | ||
python3 examples/grover/grover_example_sudoku.py | ||
python3 examples/param_shift_onchip_training/param_shift.py |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ | |
from .vqe import * | ||
from .hamiltonian import * | ||
from .qft import * | ||
from .grover import * | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Main fix is just adding this import; it must’ve gotten lost somehow when merging everything. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,12 +51,15 @@ | |
"CXCXCXLayer", | ||
"SWAPSWAPLayer", | ||
"RXYZCXLayer0", | ||
"U3CU3Layer0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that all in layers.py appears not to have all of the layers which was causing errors for one of the examples. I fixed the layer needed for the example but haven’t added all the layers yet since we will reformat the layers shortly and that can be done then. For now, just an FYI that not all the layers are in all at the moment. |
||
"QFTLayer", | ||
"SethLayer0", | ||
"EntangleLinear", | ||
"EntanglePairwise", | ||
"EntangleFull", | ||
"EntangleCircular", | ||
"EntanglementLayer", | ||
"SethLayer0", | ||
] | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: originally, this would raise an error since outside of the try/except, qiskit hasn’t been imported. I made the choice to move it inside the try so we don’t have to worry about the qiskit dependency if a user just wants to run it with pure TQ.