-
Notifications
You must be signed in to change notification settings - Fork 165
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
VQE Runtime ignores any parameters of optimizer other than SPSA/QNSPSA #407
Comments
@Cryoris Could you please help check? |
Weirdly enough without changing anything on my environment I notice now the optimiser is not ignored anymore, but I'm still seeing that when using any optimizer other than SPSA/QNSPSA, any parameters I pass to the optimizer gets ignored and it uses the default ones (looking at this via |
Yeah we updated the VQE program and alongside fixed that the optimizers are ignored 🙂 Ok the lost settings are certainly a bug though, not quite sure where this originates from since the optimizers have a |
As an example, when I pass COBYLA(maxiter=1), it shows in the logs it still has the default parameters
|
Any updates on this? |
Not yet -- I'll try having a look this week 😄 |
This issue seems to come from the encoding and decoding the optimizer which reset the settings. For example, the following serialization and deserialization of COBYLA import json
from qiskit.algorithms.optimizers import COBYLA
from qiskit.providers.ibmq.runtime import RuntimeEncoder, RuntimeDecoder
obj = COBYLA(maxiter=1)
print("Original:\n", obj.settings)
dumped = json.dumps(obj, cls=RuntimeEncoder)
loaded = json.loads(dumped, cls=RuntimeDecoder)
print("Loaded:\n", loaded.settings) prints
It seems this comes from the problem that SciPy-based optimizers cannot be reconstructed from their own settings >>> COBYLA(**obj.settings).settings
{'max_evals_grouped': 1, 'options': {'maxiter': 1000, 'disp': False, 'rhobeg': 1.0}, 'tol': None} which is an assumption we have with the runtime encoder and decoders. |
Ok something really funky is going on (keep track of >>> from qiskit.algorithms.optimizers import COBYLA
>>> one_iter_optimizer = COBYLA(maxiter=1)
>>> one_iter_optimizer.settings
{'max_evals_grouped': 1, 'options': {'maxiter': 1, 'disp': False, 'rhobeg': 1.0}, 'tol': None}
>>> COBYLA(**one_iter_optimizer.settings)
<qiskit.algorithms.optimizers.cobyla.COBYLA object at 0x7f82100709d0>
>>> one_iter_optimizer.settings
{'max_evals_grouped': 1, 'options': {'maxiter': 1000, 'disp': False, 'rhobeg': 1.0}, 'tol': None} |
Qiskit/qiskit/pull/8343 (plus backport and update of the runtime images) should fix this 🙂 |
This issue has been resolved |
Describe the bug
When running a vqe runtime through QiskitRuntimeService(channel='ibm_quantum') with an optimizer other than SPSA/QNSPSA, and looking at the logs (job.logs()), I noticed the optimizer is set to be SLSQP, even when I pass any other optimizer, it shows on the logs :
2022-07-04T09:37:35.046460730Z -- optimizer: <qiskit.algorithms.optimizers.slsqp.SLSQP object at 0x7fed33b72d60>
And later in the logs :
One of the job ids about this : cb1fncea4p74378e70v0
Steps to reproduce
The code to reproduce the error :
Expected behavior
The right optimizer shows in the logs
Suggested solutions
Additional Information
The text was updated successfully, but these errors were encountered: