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

Develop the TorchQuantum Testing Suite #261

Closed
01110011011101010110010001101111 opened this issue May 7, 2024 · 3 comments · Fixed by #268 · May be fixed by #274
Closed

Develop the TorchQuantum Testing Suite #261

01110011011101010110010001101111 opened this issue May 7, 2024 · 3 comments · Fixed by #268 · May be fixed by #274
Assignees

Comments

@01110011011101010110010001101111
Copy link
Collaborator

Currently, TQ’s tests don’t quite have full coverage, and we need your helps to achieve near-full coverage! To take on this task, take a module which has limited or lacking tests (found in test/) and write a comprehensive testing set for it! Some places that still need tests include the encoders, the operators (with different params like inverse=True), and covering all of the measurements!

Another super helpful directions we would love help with is we want to automatically run ALL of our tests using GitHub actions, but we don’t yet have a method to authenticate through IBMQ via GitHub actions. If you can design a workflow that can run the test/plugin tests on GitHub actions, that would super helpful!

The task will be considered complete if you develop a rigorous testing suite for at least two different components (and one of those tqo can be adding IBMQ support on GH actions).

@SaashaJoshi
Copy link

SaashaJoshi commented May 30, 2024

Hey,
For the GitHub Actions issue, did you try saving an IBM API Token as a GitHub secret? GitHub secrets can be called from within the GitHub Actions workflow to run the tests.

For example, the files in tests/plugin require an IBM backend and consequently require an IBM token to initiate the IBMProvider. You could do something like this in the GitHub Actions workflow,

- name: Unit Tests
- env:
    IBM_API_TOKEN: ${{ secrets.IBM_API_TOKEN }}
run: |
    python -m pytest tests

And, any file that defines the IBMProvider or QiskitRuntimeSevice such as this can be written as,

import os
token = os.getenv("IBM_API_TOKEN")

provider = QiskitRuntimeService(channel = "ibm_quantum", token=token, instance = "ibm-q-research/mass-inst-tech-1/main")

The workflow will replace IBM_API_TOKEN with the saved token.

Correct me if I am wrong in understanding the situation. If this makes sense, I am glad to open a PR to see how this works out.

Update: I worked the above on a toy model and I was able to authenticate and schedule a job on the IBM Quantum platform.

@01110011011101010110010001101111
Copy link
Collaborator Author

Hey, thanks for letting us know! Feel free to open a PR with those updates (I can add in the secret with GH secrets as you recommended) + some tests for an aspect of your choosing, and we can merge it in!

@SaashaJoshi
Copy link

Hey @GenericP3rson, just to confirm, does the testing suite require functional tests or unit tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants