Quantum transfer learning code (Mari et al., 2019) - IBMQDevice endless execution

So now I can’t run anything because I am getting : RequestsApiError: ‘401 Client Error: Unauthorized for url: https://auth.quantum-computing.ibm.com/api/users/loginWithToken. Login failed., Error code: 3446.’ :face_with_raised_eyebrow: It worked fine a while ago. Even after changing to other backends. Have also tried to create a new token, then included IBMQ.save_account('YOUR API KEY', overwrite=True) , but still.

Hi @_risto,

That sounds really odd :thinking:

Just tried a simple circuit run and it worked well with:

dev = qml.device('qiskit.ibmq', wires=2, backend='ibmq_qasm_simulator', ibmqx_token=token)

A couple of thoughts:

  • Was it not working for 'ibmq_qasm_simulator' either?
  • Was the new key created by clicking on the refresh button here? (the button with two arrows) Screenshot%20from%202021-08-12%2008-36-18
  • Was it not working after trying a bit later either? Perhaps it could have been some temporary service issues.

Now I get: No such file or directory: ‘…/_data/hymenoptera_data/train’ eventhough this folder was not changed and worked with every notebook I’ve run on Jupyter.
Lol :slight_smile:
Any ideas why?
I get same result for …/_data/hymenoptera_data/train and _data/hymenoptera_data/train

Hi @_risto,

I’m afraid I’m not sure how to assist without knowing more about the details of the situation.

  • Is that still on quantum lab?
  • Could you send the output of ls -Rla from the same directory where the jupyter notebook exists to verify that the correct directories are there?

The previous output didn’t seem to have worked, so seeing this error would not come as a surprise. Also, please note the name of the jupyter notebook that is being run.

Hi @antalszava

I get a very long list, with this at the end:
./.local/share/jupyter/runtime:
total 3
drwx-----T 1 jovyan 1000 0 Aug 2 20:47 ./
drwxr-xr-x 1 jovyan 1000 0 Aug 2 20:47 …/
-rw------- 1 jovyan 1000 314 Aug 16 17:27 jpserver-7.json
-rw-r–r-- 1 jovyan 1000 486 Aug 16 17:27 jpserver-7-open.html
-rw------T 1 jovyan 1000 263 Aug 16 17:33 kernel-ed807a6a-6b2e-47c1-b6a1-3a1ccd056125.json

./.qiskit:
total 2
drwxr-xr-x 1 jovyan 1000 0 Aug 16 17:27 ./
drwxrwxr-x 1 jovyan 1000 0 Aug 2 20:47 …/
-rw-r–r-- 1 jovyan 1000 207 Aug 16 17:27 qiskitrc
lrwxrwxrwx 1 jovyan 1000 26 Aug 16 17:27 settings.conf -> /tmp/.qiskit/settings.conf

‘./Untitled Folder’:
total 1
drwxr-xr-x 1 jovyan 1000 0 Aug 4 16:54 ./
drwxrwxr-x 1 jovyan 1000 0 Aug 2 20:47 …/

This is the full error when importing data:
Traceback (most recent call last):
File “”, line 24, in
image_datasets = {
File “”, line 25, in
x if x == “train” else “validation”: datasets.ImageFolder(
File “/opt/conda/lib/python3.8/site-packages/torchvision/datasets/folder.py”, line 253, in init
super(ImageFolder, self).init(root, loader, IMG_EXTENSIONS if is_valid_file is None else None,
File “/opt/conda/lib/python3.8/site-packages/torchvision/datasets/folder.py”, line 126, in init
classes, class_to_idx = self._find_classes(self.root)
File “/opt/conda/lib/python3.8/site-packages/torchvision/datasets/folder.py”, line 164, in _find_classes
classes = [d.name for d in os.scandir(dir) if d.is_dir()]
FileNotFoundError: [Errno 2] No such file or directory: ‘_data/hymenoptera_data/train’

Hey @_risto, and well done for your perseverance trying to run a tutorial in quantum lab.

But I am wondering if your questions are really PennyLane related, or if it is about paths in quantum lab (with which the IBMQ team may be better positioned to provide help)?

If you think they are PennyLane related (i.e. you cannot reproduce the error with just any file of that format), I would be really grateful if you could boil them back down to a few lines of code, and state how you run them - I lost a bit the overview what’s actually happening…

Hi @_risto,

Just to reply to this, it doesn’t seem like the _data does exist, at least from the part of the output that you’ve attached. If that’s the case, then that will be the reason for the FileNotFoundError that you see.

As Maria mentioned, kudos for the patience with this! :slightly_smiling_face:

Hi,

Is there any code that shows the creation of the ‘quantum_weights.pt’ file used in https://github.com/XanaduAI/quantum-transfer-learning/blob/master/quantum_processors/run_on_QPU.py? I am having issues getting Pennylane to run on quantum hardware even when saving my files then loading my weights based on simulator. Any code you could share where the quantum_weights.pt file gets created?

Hi @dancbeaulieu,

As far as I recall, quantum_weights.pt is a modified version of the quantum_ants_bees.pt generated in this file. What issues are you facing when saving and loading weights? Note that the network topologies in the saved and loaded models must agree.

1 Like