-
Notifications
You must be signed in to change notification settings - Fork 37
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
Persist circuits in batch execute #260
Persist circuits in batch execute #260
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feature/persist-batch-circuits #260 +/- ##
================================================================
Coverage 100.00% 100.00%
================================================================
Files 7 7
Lines 1211 1225 +14
Branches 295 297 +2
================================================================
+ Hits 1211 1225 +14 ☔ View full report in Codecov by Sentry. |
Hi @WingCode and thanks for raising this! It seems the linter check is failing. Locally, you can run |
@math411 I have fix the linting issues. Could you please review? |
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.
Hi @WingCode , thanks for contributing to the issue! This PR solves half of the problem stated in #255. Printing noisy circuits when using noise model is still not supported. However, after reviewing this PR, I think printing noisy circuits is not the right goal to pursue.
The right goal is to allow users to retrieve the tasks (and the task ids), from which noisy circuits can be retrieved. If you can extend this PR to include the following feature, we are good to go: "Persist the task when parallel=True", which requires
- Add an attribute
self._tasks=[]
- Add a method for returning tasks
@property
def tasks(self) -> list[QuantumTask]:
...
, similar to
amazon-braket-pennylane-plugin-python/src/braket/pennylane_plugin/braket_device.py
Line 179 in a17e8b9
def task(self) -> QuantumTask: |
3. Add unit tests for
tasks
@@ -139,6 +139,7 @@ def __init__( | |||
super().__init__(wires, shots=shots or None) | |||
self._device = device | |||
self._circuit = None | |||
self._circuits = [] |
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.
self._circuits
here is a private variable. that users should not access. Instead, users access _circuits through properties. So, there need to be a new property of this class called circuits
defined as a method of the class, similar to
amazon-braket-pennylane-plugin-python/src/braket/pennylane_plugin/braket_device.py
Line 174 in a17e8b9
def circuit(self) -> Circuit: |
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.
And yes, it's a bit repetitive now that we have both circuits
and circuit
, but I think it's okay for now. In long term, circuit
may be deprecated.
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.
Hi @WingCode, the PR looks good! I changed the target branch to be a feature branch instead of the main branch because Amazon Braket needs rework the duplication of circuit
and circuits
which requires some discussions. I will assign the issue to you and close the issue. This should be good in UnitaryHack regards. Thanks for contributing!
I somehow have trouble assigning the issue to you. I am asking my team to resolve it.
Thank you @yitchen-tim for the reviews and all of the timely support! |
03fe023
into
amazon-braket:feature/persist-batch-circuits
Issue #, if available: closes #255
Description of changes: Add persistence of multiple circuits when batch_execute is called
Testing done:
Merge Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.