-
Notifications
You must be signed in to change notification settings - Fork 395
Closed
Description
Environment
- Qiskit Machine Learning version: 0.6.0
- Python version: 3.11.2
- Operating system: MacOS 13.3.1
What is happening?
When I run the 11_quantum_convolutional_neural_networks.ipynb to learn, I want to save the classifier model, and I run the following code.
classifier.save("qcnn.classifier")
However, it will produce following error logs.
Traceback (most recent call last):
File "/Users/xxx/Projects/iu/qaml-qiskit/qcnn.py", line 246, in <module>
classifier.save("qcnn.classifier")
File "/Users/xxx/Projects/iu/qaml-qiskit/venv/lib/python3.11/site-packages/qiskit_machine_learning/algorithms/serializable_model.py", line 36, in save
dill.dump(self, handler)
File "/Users/xxx/Projects/iu/qaml-qiskit/venv/lib/python3.11/site-packages/dill/_dill.py", line 336, in dump
Pickler(file, protocol, **_kwds).dump(obj)
File "/Users/xxx/Projects/iu/qaml-qiskit/venv/lib/python3.11/site-packages/dill/_dill.py", line 620, in dump
StockPickler.dump(self, obj)
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pickle.py", line 487, in dump
self.save(obj)
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pickle.py", line 603, in save
self.save_reduce(obj=obj, *rv)
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pickle.py", line 717, in save_reduce
save(state)
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
^^^^^^^^^^^^
File "/Users/xxx/Projects/iu/qaml-qiskit/venv/lib/python3.11/site-packages/dill/_dill.py", line 1251, in save_module_dict
StockPickler.save_dict(pickler, obj)
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pickle.py", line 972, in save_dict
self._batch_setitems(obj.items())
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pickle.py", line 998, in _batch_setitems
save(v)
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
^^^^^^^^^^^^
File "/Users/xxx/Projects/iu/qaml-qiskit/venv/lib/python3.11/site-packages/dill/_dill.py", line 1963, in save_function
_save_with_postproc(pickler, (_create_function, (
File "/Users/xxx/Projects/iu/qaml-qiskit/venv/lib/python3.11/site-packages/dill/_dill.py", line 1140, in _save_with_postproc
pickler.save_reduce(*reduction, obj=obj)
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pickle.py", line 692, in save_reduce
save(args)
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pickle.py", line 902, in save_tuple
save(element)
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
^^^^^^^^^^^^
File "/Users/xxx/Projects/iu/qaml-qiskit/venv/lib/python3.11/site-packages/dill/_dill.py", line 1187, in save_code
obj.co_firstlineno, obj.co_lnotab, obj.co_endlinetable,
^^^^^^^^^^^^^^^^^^^
AttributeError: 'code' object has no attribute 'co_endlinetable'. Did you mean: 'co_linetable'?
Process finished with exit code 1
How can we reproduce the issue?
Run the code in 11_quantum_convolutional_neural_networks.ipynb](https://github.com/Qiskit/qiskit-machine-learning/blob/main/docs/tutorials/11_quantum_convolutional_neural_networks.ipynb), and try to save the model using following code.
classifier.save("qcnn.classifier")
What should happen?
The classifier should be saved into a file.
Any suggestions?
No response
Metadata
Metadata
Assignees
Labels
No labels