-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
Bump cirq version from 0.10.0
to 0.13.0
#988
Conversation
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.
Hello @vtomole, thank you for submitting a PR to Mitiq! We will respond as soon as possible, and if you have any questions in the meantime, you can ask us on the Unitary Fund Discord.
@rmlarose Done. |
Thank you @vtomole. At validation there are these errors
I could not track where There are also these issues in tests with pennylane and PEC:
|
cirq. |
@vtomole Thanks! There are also other strange errors on PennyLane tests that I don't immediately understand (maybe Cirq changed something about qasm conversions 🤔). |
quantumlib/Cirq#4113 breaks the pennylane conversion to a point where
compiles to
Notice the |
Thanks for looking in detail into the breaking issue, @vtomole. |
@nathanshammah What do you think is best way to fix this? I think we should raise this issue up to pennylane because
|
Pennylane doesn't support import pennylane
qasm_string = """
// Generated from Cirq v0.13.1
OPENQASM 2.0;
include "qelib1.inc";
// Qubits: [0, 1]
qreg q[2];
rz(0) q[0];
rx(pi*0.1) q[1];
sx q[1];
rz(pi*0.4) q[1];
s q[1];
cx q[0],q[1];
"""
qfunc = pennylane.from_qasm(qasm_string)
with pennylane.tape.QuantumTape() as tape:
qfunc(wires=pennylane.wires.Wires(range(2)))
print(tape.operations)
# prints
# [RZ(0.0, wires=[0]),
# RX(0.3141592653589793, wires=[1]),
# QubitUnitary(array([[0.5+0.5j, 0.5-0.5j],
# [0.5-0.5j, 0.5+0.5j]]), wires=[1]),
# RZ(1.2566370614359172, wires=[1]),
# S(wires=[1]),
# CNOT(wires=[0, 1])] Just moved to PennyLaneAI/pennylane#1891 |
Not a solution; but to get this PR in we could remove the |
The fix: PennyLaneAI/pennylane-qiskit#158 |
Thanks for asking for this fix in PL, @vtomole! Given this fact, I think we just need to wait. |
Great suggestion, @vtomole! |
I'm getting conflicting information. Should we wait for that Pennylane PR to get merged and for Pennylane to cut a new release before we merge this or should we modify the test here so it passes for us? |
@vtomole I referred to the idea of upstreaming this to Pennylane and the issue you opened on Pennylane. Let's wait for that release. We can also discuss at the Mitiq meeting if you want to join, at 12pm ET on http://discord.unitary.fund/ |
Okay, thanks for clearing that up! |
@rmlarose @nathanshammah @rmlarose Ready for re-review 🙂 |
The docs check is failing with a
message. |
This can randomly happen when one of the examples has a call to |
Codecov Report
@@ Coverage Diff @@
## master #988 +/- ##
=======================================
Coverage 97.98% 97.98%
=======================================
Files 54 54
Lines 2527 2527
=======================================
Hits 2476 2476
Misses 51 51
Continue to review full report at Codecov.
|
@nathanshammah @andreamari Ready for re-review :) |
mitiq/interface/mitiq_pennylane/tests/test_conversions_pennylane.py
Outdated
Show resolved
Hide resolved
u_1 = cirq.unitary(base_circ) | ||
u_2 = cirq.unitary(circ_recovered) | ||
|
||
assert np.allclose(u_1, u_2) | ||
cirq.testing.assert_allclose_up_to_global_phase(u_1, u_2, atol=0) |
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.
Nice!
params = list(np.pi * np.random.rand(gate.num_params)) | ||
rnd_wires = np.random.choice( | ||
range(n_wires), size=gate.num_wires, replace=False | ||
) | ||
gate( | ||
*params, | ||
wires=[ | ||
int(w) for w in rnd_wires | ||
], # make sure we do not address wires as 0-d arrays | ||
) |
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.
I guess you had to remove this for some tricky reason.
If not possible to re-introduce:
- Can we restore the random rotation parameters only?
- Can we restore the random wires only?
If not, it's fine. This is not a blocker for this PR.
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.
The reason for this change is because gate.num_params
is now dynamic. Since this test is copied from pennylane, the following PR recommends re-writing the test this way. See https://github.com/PennyLaneAI/pennylane/pull/1898/files#r750946650.
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.
Ah, I see, very nice finding!
…ne.py Co-authored-by: Andrea Mari <[email protected]>
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.
Many thanks @vtomole! LGTM
(running all the tests now, we can merge once they pass)
Hi @astrojuanlu, do you know why RDT is failing for this PR (and only for this PR)? My guess, please correct me if I am wrong, is this: due to a slightly longer pip install process, the docs build of this PR exceeds the 15 minutes limit that is discussed at this page (https://docs.readthedocs.io/en/stable/builds.html). We can increase build limits on a per-project basis. Send an email to [email protected] providing a good reason why your documentation needs more resources. Do you think we can get some extra build time? This would help us unblock urgent PRs until we find a more scalable solution for the docs. |
Hi @andreamari ! It looks like the other builds are on the edge of the 15 minute limit. Looks like most of the build time is spent executing notebooks, which makes a ton of sense. Please send an email to [email protected] and the support team will take care of it :) |
Thanks @astrojuanlu for the info and @andreamari for investigating. If we switch in the future to Jupyter book, it may be simpler to cache notebooks (at least for some CI checks). |
I just sent and email to [email protected], thanks for the advice! |
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.
Thank you @vtomole, all tests now pass.
And also thanks to @astrojuanlu (RTD is working now)! |
@nathanshammah @andreamari Thanks for your patience! |
@allcontributors please add @vtomole for tests and code |
I've put up a pull request to add @vtomole! 🎉 |
Replacing #915
Description
Checklist
Check off the following once complete (or if not applicable) after opening the PR. The PR will be reviewed once this checklist is complete and all tests are passing.
If some items remain, you can mark this a draft pull request.
Tips
If the validation check fails:
Run
make check-types
(from the root directory of the repository) and fix any mypy errors.Run
make check-style
and fix any flake8 errors.Run
make format
to format your code with the black autoformatter.For more information, check the Mitiq style guidelines.
Write "Fixes #XYZ" in the description if this PR fixes Issue #XYZ.