You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a circuit via SamplerV2 on a real QPU, the PubResult corresponding to the circuit contains a metadata attribute that reproduces the original circuit metadata. However, when running that circuit on a fake backend, the metadata attribute is not present in the PubResult.
Steps to reproduce
Run the script below. The script duplicates the example script in the fake backend documentation and simply adds metadata to the circuit. The first print line correctly prints the circuit metadata, which survives transpilation. The second print line prints an empty dictionary, rather than the circuit metadata.
from qiskit.circuit import QuantumCircuit
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit_ibm_runtime import SamplerV2 as Sampler
from qiskit_ibm_runtime.fake_provider import FakeManilaV2
# Bell Circuit
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()
qc.metadata = {0: 1}
# Run the sampler job locally using FakeManilaV2
fake_manila = FakeManilaV2()
pm = generate_preset_pass_manager(backend=fake_manila, optimization_level=0)
isa_qc = pm.run(qc)
print(f'circuit metadata: {isa_qc.metadata}')
# You can use a fixed seed to get fixed results.
options = {"simulator": {"seed_simulator": 42}}
sampler = Sampler(backend=fake_manila, options=options)
result = sampler.run([isa_qc]).result()
print(f'circuit metadata: {result.metadata}')
Expected behavior
Retain circuit metadata in SamplerV2 when running fake backend, identically to behaviour on real QPU.
qiskit-ibm-runtime version: 0.22.0
Python version: 3.11.6
Operating system: macOS Sonoma 14.4
The text was updated successfully, but these errors were encountered:
Describe the bug
When running a circuit via
SamplerV2
on a real QPU, thePubResult
corresponding to the circuit contains ametadata
attribute that reproduces the original circuit metadata. However, when running that circuit on a fake backend, themetadata
attribute is not present in thePubResult
.Steps to reproduce
Run the script below. The script duplicates the example script in the fake backend documentation and simply adds metadata to the circuit. The first
print
line correctly prints the circuit metadata, which survives transpilation. The secondprint
line prints an empty dictionary, rather than the circuit metadata.Expected behavior
Retain circuit metadata in
SamplerV2
when running fake backend, identically to behaviour on real QPU.The text was updated successfully, but these errors were encountered: