SEAL-Python: Cannot deep copy certain seal objects
Hey there Huelse, I am having some difficulty deep copying some objects of seal-python giving me:
Traceback (most recent call last):
File "/python-fhe/fhe/fhe.py", line 123, in _merge_dictionary
copy.deepcopy(d)
File "/usr/lib/python3.8/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/usr/lib/python3.8/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python3.8/copy.py", line 161, in deepcopy
rv = reductor(4)
TypeError: cannot pickle 'seal.SEALContext' object
or
Traceback (most recent call last):
File "/python-fhe/fhe/fhe.py", line 124, in _merge_dictionary
dicts = copy.deepcopy(dicts)
File "/usr/lib/python3.8/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/usr/lib/python3.8/copy.py", line 210, in _deepcopy_tuple
y = [deepcopy(a, memo) for a in x]
File "/usr/lib/python3.8/copy.py", line 210, in <listcomp>
y = [deepcopy(a, memo) for a in x]
File "/usr/lib/python3.8/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/usr/lib/python3.8/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python3.8/copy.py", line 161, in deepcopy
rv = reductor(4)
TypeError: cannot pickle 'seal.PublicKey' object
Its interesting that deep copying results in a pickle of these objects.
Not sure if you know of a workaround, or anything I can help with in particular to make it possible to deep copy.
Thanks as usual.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 24 (24 by maintainers)
You need the
stl_bind, there are a lot of examples in pybind11’s tests - https://github.com/pybind/pybind11/blob/master/tests/test_stl_binders.cpp But I think it’s unnecessary, there is a simple way to pickle theEncryptionParametersThe point is the keys and ciphertext. Here is: https://github.com/Huelse/SEAL-Python/commit/70fc82b8b996076e6ea9a3511fff18ee8cf76af6