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
Operating System: Ubuntu 20.04.5 LTS
Kernel: Linux 5.4.0-173-generic
Architecture: x86-64
What is happening?
I'm trying to run a quantum kernel using the ComputeUncompute class on a quantum system. I'm submitting a transpiled circuit however it fails raising the following issue on the IBM-quantum platform dashboard
Failed - Circuits do not match the target definition (non-ISA circuits). -- \n Transpile your circuits for the target before submitting a primitive query. For\n example, you can use the following code block given an IBMBackend object backend \n and circuits of type List[QuantumCircuit]:\n from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager\n pm = generate_preset_pass_manager(optimization_level=1, target=backend.target)\n isa_circuits = pm.run(circuits)\n Then pass isa_circuits to the Sampler or Estimator.\n -- https://ibm.biz/error_codes#1517
and the following error on the terminal:
Traceback (most recent call last):
File "/CTGlab/home/valeria/miniconda3/envs/qiskit-buona/lib/python3.10/site-packages/qiskit/algorithms/state_fidelities/compute_uncompute.py", line 161, in _run
result = job.result()
File "/CTGlab/home/valeria/miniconda3/envs/qiskit-buona/lib/python3.10/site-packages/qiskit_ibm_runtime/runtime_job.py", line 220, in result
raise RuntimeJobFailureError(f"Unable to retrieve job result. {error_message}")
qiskit_ibm_runtime.exceptions.RuntimeJobFailureError: 'Unable to retrieve job result. Circuits do not match the target definition (non-ISA circuits). -- \\n Transpile your circuits for the target before submitting a primitive query. For\\n example, you can use the following code block given an IBMBackend object backend\\n and circuits of type
List[QuantumCircuit]:\\n from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager\\n pm = generate_preset_pass_manager(optimization_level=1, target=backend.target)\\n isa_circuits = pm.run(circuits)\\n Then pass isa_circuits to the Sampler or Estimator.\\n -- https://ibm.biz/error_codes#1517'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Volumes/HD2/home/valeria/Quantum-Machine-Learning-for-Expression-Data/Qkernel_test_ISA.py", line 113, in <module>
test=fidelity._run(ft_map_t_qs,ft_map_t_qs,X_train_scaled[0],X_train_scaled[1])
File "/CTGlab/home/valeria/miniconda3/envs/qiskit-buona/lib/python3.10/site-packages/qiskit/algorithms/state_fidelities/compute_uncompute.py", line 163, in _run
raise AlgorithmError("Sampler job failed!") from exc
qiskit.algorithms.exceptions.AlgorithmError: 'Sampler job failed!'
This is happening only on real systems, whereas when run on simulator the code works fine.
How can we reproduce the issue?
Here is the code I've been running to test this issue:
## Importing standard Qiskit libraries
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit.visualization import *
# Importing standard Qiskit libraries and configuring account
from qiskit_ibm_runtime import QiskitRuntimeService, Options
import qiskit_ibm_runtime
#from qiskit.utils import algorithm_globals
#Load feature maps
from qiskit.circuit.library import ZZFeatureMap,ZFeatureMap
from qiskit.algorithms.state_fidelities import ComputeUncompute
from qiskit_machine_learning.kernels import FidelityQuantumKernel
#Load other libraries
import pickle
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
import os
import json
import argparse
########################QUANTUM SESSION#########################################################
# Loading your IBM Quantum account(s)
print('Loading IBM Quantum account')
# Loading your IBM Quantum account(s)
service=QiskitRuntimeService(channel="ibm_quantum",token="***")
print('selecting backend')
backend = service.least_busy(operational=True, simulator=False)
print(backend)
target = backend.target
coupling_map = target.build_coupling_map()
print('FT map instance')
#Instance FTMAP
n_qubits=4
reps=1
ft_map = ZZFeatureMap(feature_dimension=n_qubits, reps=1)
#transpile circuit
print('transpile circuit')
pm=generate_preset_pass_manager(target=backend.target,optimization_level=3,initial_layout=[0,1,2,3],seed_transpiler=42)
ft_map_t_qs = pm.run(ft_map)
######################## DATA PREPROCESSING ######################################################
#Generate sample data
X_train=np.random.rand(10,4)
scaler = MinMaxScaler(feature_range=(0, 1*np.pi))
scaler.fit(X_train)
X_train_scaled = scaler.transform(X_train)
#########################LAUNCH EXP#########################################################
#Set primitive sampler options
options = Options()
#Error mitigation level (resilience_level)
options.resilience_level = 1
#Optimization level
options.optimization_level = 3
#Number of shots
options.execution.shots = 2000
#Skip translation since the circuit is already transpiled
options.skip_transpilation= False
# Create a quantum kernel based on the transpiled feature map
#Set Primitive sampler
sampler = qiskit_ibm_runtime.Sampler(backend=backend, options=options)
#Set fidelity
fidelity = ComputeUncompute(sampler=sampler)
#run circuit using fidelity
test=fidelity._run(ft_map_t_qs,ft_map_t_qs,X_train_scaled[0],X_train_scaled[1])
What should happen?
I expect the circuit to be able to run on the system without any problems since I'm transpiling it before submitting the job. This problem never occurred before when running other FidelityQuantumKernel(that employ the ComputeUncompute) instances before without any problems regarding the circuit, and this issue raised only after the qiskit-runtime-primitives-update
Any suggestions?
I think this possibly due to how the ComputeUncompute construct the circuit by appending two circuits that are already transpiled wheras it might be more "proper" to constract the full circuit and then transpile it.
The text was updated successfully, but these errors were encountered:
Environment
What is happening?
I'm trying to run a quantum kernel using the ComputeUncompute class on a quantum system. I'm submitting a transpiled circuit however it fails raising the following issue on the IBM-quantum platform dashboard
Failed - Circuits do not match the target definition (non-ISA circuits). -- \n Transpile your circuits for the target before submitting a primitive query. For\n example, you can use the following code block given an IBMBackend object backend \n and circuits of type List[QuantumCircuit]:\n from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager\n pm = generate_preset_pass_manager(optimization_level=1, target=backend.target)\n isa_circuits = pm.run(circuits)\n Then pass isa_circuits to the Sampler or Estimator.\n -- https://ibm.biz/error_codes#1517
and the following error on the terminal:
This is happening only on real systems, whereas when run on simulator the code works fine.
How can we reproduce the issue?
Here is the code I've been running to test this issue:
What should happen?
I expect the circuit to be able to run on the system without any problems since I'm transpiling it before submitting the job. This problem never occurred before when running other FidelityQuantumKernel(that employ the ComputeUncompute) instances before without any problems regarding the circuit, and this issue raised only after the qiskit-runtime-primitives-update
Any suggestions?
I think this possibly due to how the ComputeUncompute construct the circuit by appending two circuits that are already transpiled wheras it might be more "proper" to constract the full circuit and then transpile it.
The text was updated successfully, but these errors were encountered: