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

Use QPY as exchange format #104

Merged
merged 19 commits into from
Nov 11, 2024
Merged

Use QPY as exchange format #104

merged 19 commits into from
Nov 11, 2024

Conversation

jesus-talavera-ibm
Copy link
Contributor

Summary

Fixes #103

Details and comments

@jesus-talavera-ibm jesus-talavera-ibm self-assigned this Oct 30, 2024
Copy link
Member

@cbjuan cbjuan left a comment

Choose a reason for hiding this comment

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

Overall looks good.

I have some comments to double-check about potential cases in which we could receive a qasm

@@ -66,8 +67,8 @@ def transpile(

results = []
for transpile_resp in transpile_resps:
if transpile_resp.get("success") and transpile_resp.get("qasm") is not None:
results.append(QuantumCircuit.from_qasm_str(transpile_resp.get("qasm")))
if transpile_resp.get("success") and transpile_resp.get("qpy") is not None:
Copy link
Member

Choose a reason for hiding this comment

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

If we can send the circuits as qasm because of the fallback, couldn’t we receive the result in qasm format too?

if so, we should add it to this part of the method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I simplified the logic using deserialize_circuit_from_qpy_or_qasm() function

Copy link
Member

Choose a reason for hiding this comment

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

Excellent! Thanks

if transpile_resp.get("success") and transpile_resp.get("qasm") is not None:
results.append(QuantumCircuit.from_qasm_str(transpile_resp.get("qasm")))
if transpile_resp.get("success") and transpile_resp.get("qpy") is not None:
results.append(get_circuit_from_qpy(transpile_resp.get("qpy")))
Copy link
Member

Choose a reason for hiding this comment

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

Same comment about qasm

if transpile_resp.get("success") and transpile_resp.get("qasm") is not None:
results.append(QuantumCircuit.from_qasm_str(transpile_resp.get("qasm")))
if transpile_resp.get("success") and transpile_resp.get("qpy") is not None:
results.append(get_circuit_from_qpy(transpile_resp.get("qpy")))
Copy link
Member

Choose a reason for hiding this comment

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

Again

@@ -409,6 +430,14 @@ def test_fix_ecr_qasm3():
assert isinstance(list(circuit_from_qasm)[0].operation, ECRGate)


def test_fix_ecr_qpy():
Copy link
Member

Choose a reason for hiding this comment

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

I’d say this is not needed with QPY

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. Thank you!

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

@jesus-talavera-ibm jesus-talavera-ibm merged commit 9f6b8e3 into main Nov 11, 2024
4 checks passed
@jesus-talavera-ibm jesus-talavera-ibm deleted the jt-use-qpy branch November 11, 2024 16:21
jesus-talavera-ibm added a commit that referenced this pull request Nov 11, 2024
* Use QPY as exchange format

* Fix tests

* Fix tests for QuantumVolume

* Add test to check wrong input circuits

* Convert last tests that were using QASM

* Add ecr test for qpy

* Add fix to avoid random test errors

* Revert "Add fix to avoid random test errors"

This reverts commit 505fea3.

* Add release notes

* Accept only QuantumCircuit as input

* Fix tests

* Use QASM as fallback serialization format if QPY fails

* Fix test_layout_construction_no_service

* Fix code for Python 3.8

* Add testcase for qpy fallback

* Code review suggestions
jesus-talavera-ibm added a commit that referenced this pull request Nov 11, 2024
* Use QPY as exchange format

* Fix tests

* Fix tests for QuantumVolume

* Add test to check wrong input circuits

* Convert last tests that were using QASM

* Add ecr test for qpy

* Add fix to avoid random test errors

* Revert "Add fix to avoid random test errors"

This reverts commit 505fea3.

* Add release notes

* Accept only QuantumCircuit as input

* Fix tests

* Use QASM as fallback serialization format if QPY fails

* Fix test_layout_construction_no_service

* Fix code for Python 3.8

* Add testcase for qpy fallback

* Code review suggestions
jesus-talavera-ibm added a commit that referenced this pull request Nov 11, 2024
jesus-talavera-ibm added a commit that referenced this pull request Nov 11, 2024
* Use QPY as exchange format

* Fix tests

* Fix tests for QuantumVolume

* Add test to check wrong input circuits

* Convert last tests that were using QASM

* Add ecr test for qpy

* Add fix to avoid random test errors

* Revert "Add fix to avoid random test errors"

This reverts commit 505fea3.

* Add release notes

* Accept only QuantumCircuit as input

* Fix tests

* Use QASM as fallback serialization format if QPY fails

* Fix test_layout_construction_no_service

* Fix code for Python 3.8

* Add testcase for qpy fallback

* Code review suggestions
jesus-talavera-ibm added a commit that referenced this pull request Nov 11, 2024
* Use QPY as exchange format

* Fix tests

* Fix tests for QuantumVolume

* Add test to check wrong input circuits

* Convert last tests that were using QASM

* Add ecr test for qpy

* Add fix to avoid random test errors

* Revert "Add fix to avoid random test errors"

This reverts commit 505fea3.

* Add release notes

* Accept only QuantumCircuit as input

* Fix tests

* Use QASM as fallback serialization format if QPY fails

* Fix test_layout_construction_no_service

* Fix code for Python 3.8

* Add testcase for qpy fallback

* Code review suggestions
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.

Use QPY as exchange format
2 participants