กำหนดค่า noise management ด้วย Sampler
เวอร์ชันแพ็กเกจ
โค้ดในหน้านี้พัฒนาโดยใช้ requirements ต่อไปนี้ แนะนำให้ใช้เวอร์ชันเหล่านี้หรือใหม่กว่า
qiskit-ibm-runtime~=0.47.0
การจัดการ noise ทำได้หลายวิธี ส่วนใหญ่ใช้เทคนิค error mitigation และ error suppression ต่างๆ เพื่อป้องกันข้อผิดพลาดก่อนที่จะเกิดขึ้น เทคนิคเหล่านี้มักเพิ่มโอเวอร์เฮดในขั้นตอนประมวลผลล่วงหน้า ดังนั้น จึงสำคัญที่จะต้องหาจุดสมดุลระหว่างการปรับปรุงผลลัพธ์และการทำให้งานเสร็จในเวลาที่เหมาะสม
Sampler รองรับเทคนิค noise management ต่อไปนี้ ดู Error mitigation and suppression techniques สำหรับคำอธิบายของแต่ละเทคนิค
หมายเหตุ
ไม่ใช่ทุกตัวเลือกที่จะใช้ร่วมกันได้กับ circuit ทุกประเภท ดูรายละเอียดทั้งหมดที่คู่มือ feature compatibility table
ตัวอย่าง
# Added by doQumentation — installs the packages this notebook needs if they are missing
import importlib.util
_needed = {"qiskit_ibm_runtime": "qiskit-ibm-runtime"}
_missing = [pip for module, pip in _needed.items()
if importlib.util.find_spec(module) is None]
# One at a time, so a package that fails to install does not block the others
for _pip in _missing:
%pip install -q {_pip}
if not _missing:
print("\u2713 All required packages are installed")
from qiskit_ibm_runtime import QiskitRuntimeService
# Legacy server-side primitive before qiskit-ibm-runtime 0.50.0
# from qiskit_ibm_runtime import Sampler
# Client-side primitive introduced in qiskit-ibm-runtime 0.50.0
from qiskit_ibm_runtime.executor_sampler import Sampler
service = QiskitRuntimeService()
backend = service.least_busy(operational=True, simulator=False)
sampler = Sampler(backend)
# Turn on dynamical decoupling with sequence XpXm.
sampler.options.dynamical_decoupling.enable = True
sampler.options.dynamical_decoupling.sequence_type = "XpXm"
# Turn on gate twirling. Requires qiskit_ibm_runtime 0.23.0 or later.
sampler.options.twirling.enable_gates = True
print(
f">>> dynamical decoupling sequence to use: "
f"{sampler.options.dynamical_decoupling.sequence_type}"
)
print(
f">>> gate twirling is turned on: {sampler.options.twirling.enable_gates}"
)
>>> dynamical decoupling sequence to use: XpXm
>>> gate twirling is turned on: True
ขั้นตอนถัดไป
คำแนะนำ
- เรียนรู้เพิ่มเติมเกี่ยวกับ เทคนิค error mitigation และ error suppression
- สำรวจ Sampler options
- ตัดสินใจว่าจะรัน job ใน execution mode ใด