-
Notifications
You must be signed in to change notification settings - Fork 328
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
SamplerQNN: TypeError: run() takes 2 positional arguments but 3 were given #839
Comments
Hi @xaviervasques, thanks for raising this issue. It appears because V2 primitives are not supported in Qiskit Machine Learning 0.7.2 ( see #742 and #786) but are the only type that Qiskit IBM Runtime supports for running jobs on real backends. The upcoming 0.8.0 version includes support for V2 primitives, so this error should disappear after you run with upgraded Qiskit Machine Learning ( More details on this error
Proposed temporary solutionWe should expect your experiment to run on hardware with the upcoming 0.8.0 version and V2 primitive support. Until then, you may run simulations of from qiskit_ibm_runtime import EstimatorV1 as Estimator, SamplerV1 as Sampler
sampler = Sampler(backend)
sampler_qnn = SamplerQNN(
circuit=qc,
input_params=input_params,
weight_params=weight_params,
interpret=parity,
output_shape=2, # Number of classes
sampler=sampler
) With this setup, you will be able to switch to submitting to the real device just by changing the definitions of |
Thank you Edoardo. I will wait for the 0.8.0, hope it is coming soon :) |
Yes indeed, we are looking forward to it! The feature will be in the main branch as soon as the PR is merged, but live from |
Looking forward to the 0.8.0. |
Environment
Name: qiskit-machine-learning
Version: 0.8.0
(I have tried 0.7, 0.5 ...)
Python 3.9.20
MacOS
What is happening?
Hello,
I am trying to run a SamplerQNN but since new version of qiskit I am not able to run it on real hardware (on local machine it works).
I have the following code that I run with my local machine and that works perfectly:
When I want to run it on real hardware, I did the following modifications and doesn't work:
I get the following error message:
If I change
from qiskit_ibm_runtime import QiskitRuntimeService, EstimatorV2 as Estimator, SamplerV2 as Sampler
to
from qiskit.primitives import Sampler
I have the following error message:
Can you please help me ?
Thank you in advance
How can we reproduce the issue?
I provided the code above
What should happen?
The output should be something like:
Any suggestions?
No response
The text was updated successfully, but these errors were encountered: