-
Notifications
You must be signed in to change notification settings - Fork 127
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
Error in executing StateTomography jobs on real device #1060
Comments
I am having a similar issue with the ProcessTomography experiment. It seems that the circuits are breaking the qpy encoding/decoding. Minimal example that fails from qiskit import QuantumCircuit
from qiskit_experiments.library import StateTomography
from qiskit_ibm_provider import qpy
def encode_decode(qc):
with open('test.qpy', 'wb') as fd:
qpy.dump(qc, fd)
with open('test.qpy', 'rb') as fd:
new_qc = qpy.load(fd)[0]
return new_qc
# This throws an Exception
qc = QuantumCircuit(2)
tomography = ProcessTomography(circuit=qc)
qc_ = tomography.circuits()[0]
encode_decode(qc_) The root cause Here is a simple circuit with the same behaviour. _prep_indices = (0, 1)
# Fails -- passing a tuple to barrier
qc = QuantumCircuit(2)
qc.barrier(_prep_indices)
encode_decode(qc) Possible fix # Proposed solution 1 -- unpack tuple
qc = QuantumCircuit(2)
qc.barrier(*_prep_indices)
encode_decode(qc)
# Proposed solution 2 -- convert to list
qc = QuantumCircuit(2)
qc.barrier(list(_prep_indices))
encode_decode(qc) |
Thanks, @spratapsi! I would say that this does belong in qiskit-experiments. I will make PR soon to fix this in tomography_experiment.py. |
`QuantumCircuit.barrier()` accepts many forms of input, but `tuple` is not one of them. The prep and measurement indices passed as tuples to the barrier method were causing qpy serialization/deserialization to fail. It is possible that there were other unnoticed consequences to the type of the barrier argument being incorrect. Closes https://github.com/Qiskit/qiskit-ibm-provider/issues/523
<!--⚠️ If you do not respect this template, your pull request will be closed.⚠️ Your pull request title should be short detailed and understandable for all.⚠️ Also, please add it in the CHANGELOG file under Unreleased section.⚠️ If your pull request fixes an open issue, please link to the issue. ✅ I have added the tests to cover my changes. ✅ I have updated the documentation accordingly. ✅ I have read the CONTRIBUTING document. --> ### Summary Fix barrier instructions in tomography experiments ### Details and comments `QuantumCircuit.barrier()` accepts many forms of input, but `tuple` is not one of them. The prep and measurement indices passed as tuples to the barrier method were causing qpy serialization/deserialization to fail. It is possible that there were other unnoticed consequences to the type of the barrier argument being incorrect. Closes #1060. See also [this Slack thread](https://qiskit.slack.com/archives/CGZDF48EN/p1676934228659149).
Information
In addition, I'm using the latest version of qiskit_experiments on github with qiskit 0.41.0.
What is the current behavior?
I have an error when running StateTomography job from the qiskit_experiments library. The simulators work well but jobs from real backends keep failing. The error message indicates some I/O errors:
Steps to reproduce the problem
The text was updated successfully, but these errors were encountered: