Currently, sessions cannot be used by IBM users on the Open plan. We recommend referring to the Qiskit Session documentation and opening a session with Qiskit’s session directly.
What does it mean “opening a session with Qiskit’s session directly”? Should I rewrite my entire pennylane code into qiskit and then use qiskit sessions natively?
Not really. You can either run everything as normal with PennyLane and the PennyLane-Qiskit plugin, and Qiskit will run your code as separate jobs, or you can import Session from qiskit_ibm_runtime and use a context manager (with Session(backend=backend) as session: ) to create a session directly with IBM and then run your PennyLane circuits within that context manager.
Let me know if this makes sense or if it’s confusing and I can share an example.
Thanks for clearing things up! Yes, an exmple to use sessions for VQAs would be appreciated. I have looked at some pennylane tutorials, though I think your explanation would be better.
I have no experience with this. Can I use sessions effectively if I am on IBM’s free version (open plan)? I want to use them to run a VQA algorithm on a quantum computer. My understanding is that it should open a single session and run the optimization loop within it.
I tried to implement a VQA on a quantum computer, but sessions keep being created for some reason. It has not even finished a single iteration in this whole time .
After some tests I found that, although Qiskit technically allows you to create sessions in the free plan, in practice everything runs in job mode regardless, meaning that you could be waiting hours between consecutive iterations.
This means that you can use qiskit_session as shown in this demo
from pennylane_qiskit import qiskit_session
...
with qiskit_session(dev) as session:
Or you can use Qiskit’s Session directly
from qiskit_ibm_runtime import Session
...
with Session(backend=backend, max_time='2h') as session:
But your jobs will still run separate from each other instead of all together.
Given the above, it’s probably best to avoid using sessions if you’re on the open plan.
Since your question is unrelated to the current topic it’s best if you open a new topic and ask your question there. You can got o https://discuss.pennylane.ai/ and there you’ll see the “NEW TOPIC” button. Thanks!