Skip to content
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

Conversation

01110011011101010110010001101111
Copy link
Collaborator

Adding a feature which, along with running the tests, runs some examples. If we make some sort of breaking change that causes the examples to throw an error, we will be notified of it.

Currently just has the qubit-rotation, and I'll add some more which are compatible (for example, mnist isn't compatible at the moment since it uses IBMQ credentials).

@01110011011101010110010001101111
Copy link
Collaborator Author

As I’m working through this, noting examples I haven’t added:

Depends on IBMQ Account:

  • examples/vqe/new_simple_vqe_noise_model.py
  • examples/quantumnat/quantumnat.py
  • examples/qaoa/max_cut_paramshift.py
  • examples/mnist/mnist.py

Bugs (denoting ** for quick fixes in another pass-through):

  • examples/vqe/new_simple_vqe.py **
  • examples/save_load_example/save_load.py
  • examples/regression/new_run_regression.py **
  • examples/quanvolution/quanvolution_trainable_quantum_layer.py **
  • examples/optimal_control/optimal_control_multi_qubit.py **
  • examples/optimal_control/optimal_control_gaussian.py **
  • examples/optimal_control/optimal_control.py **
  • examples/grover/grover_example_sudoku.py **
  • examples/clifford_qnn/mnist_clifford_qnn.py

Edits Needed before I can integrate:

  • examples/qiskit/*.py — qiskit
  • examples/quest/train.py — needs extra dependency
  • examples/quanvolution/quanvolution.py — need to add argument for epochs
  • examples/quantumnat/quantize.py — needs torch CUDA
  • examples/quantum_lstm/qlstm.py — needs extra parameters (for epochs, pdb, and showing output)
  • examples/qaoa/max_cut_backprop.py — need extra parameters (steps, show plots, etc.)
  • examples/hadamard_grad/hadamard_grad.py — doesn’t call anything at the moment
  • examples/gradient_pruning/*.py — doesn’t call anything at the moment
  • examples/cuquantum/cuquantum_plugin.py — need cuquantum

@@ -305,12 +305,11 @@ def main():
model.set_qiskit_processor(processor_simulation)
valid_test(dataflow, q_device, "test", model, device, qiskit=True)

# final valid
valid_test(dataflow, q_device, "valid", model, device, True)
Copy link
Collaborator Author

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.

@@ -51,6 +51,7 @@
"CXCXCXLayer",
"SWAPSWAPLayer",
"RXYZCXLayer0",
"U3CU3Layer0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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.

@@ -25,3 +25,4 @@
from .vqe import *
from .hamiltonian import *
from .qft import *
from .grover import *
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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.

@01110011011101010110010001101111
Copy link
Collaborator Author

Fixed all of the smaller bugs. This is an updated list of all of the scripts I haven’t yet added to the workflow with some notes.

Bugs:

  • examples/clifford_qnn/mnist_clifford_qnn.py

Edits Needed before I can integrate:

  • Needs Extra Parameters

    • examples/quanvolution/quanvolution.py — need to add argument for epochs
    • examples/quantum_lstm/qlstm.py — needs extra parameters (for epochs, pdb, and showing output)
    • examples/qaoa/max_cut_backprop.py — need extra parameters (steps, show plots, etc.)
    • examples/optimal_control/* — need extra parameters (mainly enable/disable pdb)
  • Needs Extra Dependencies

    • examples/quest/train.py — needs extra dependency
    • examples/cuquantum/cuquantum_plugin.py — needs extra dependency
  • Doesn’t Call Anything

    • examples/hadamard_grad/hadamard_grad.py — doesn’t call anything at the moment
    • examples/gradient_pruning/*.py — doesn’t call anything at the moment
  • Misc.

    • examples/qiskit/*.py — qiskit
    • examples/save_load_example/save_load.py — not adding it quite yet because will need to look deeper into how to save/load files in CI/CD

Needs CUDA:

  • examples/vqe/new_simple_vqe.py
  • examples/quantumnat/quantize.py

Depends on IBMQ Account:

  • examples/vqe/new_simple_vqe_noise_model.py
  • examples/quantumnat/quantumnat.py
  • examples/qaoa/max_cut_paramshift.py
  • examples/mnist/mnist.py

@01110011011101010110010001101111 01110011011101010110010001101111 marked this pull request as ready for review November 27, 2023 20:04
@01110011011101010110010001101111
Copy link
Collaborator Author

Looks like 3.12 is failing because one of the qiskit dependencies (disutils) is fully removed as of Python 3.12. There exists workarounds, but I expect the update should be pushed soon.

Copy link
Collaborator

@Hanrui-Wang Hanrui-Wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed

Copy link
Collaborator

@Hanrui-Wang Hanrui-Wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed

@Hanrui-Wang Hanrui-Wang changed the base branch from dev to dev-zhuoyang-dm February 11, 2024 03:06
@Hanrui-Wang Hanrui-Wang changed the base branch from dev-zhuoyang-dm to dev February 11, 2024 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants