Skip to content
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

failed to serialize the context #452

Open
xuefeng-xu opened this issue Jul 6, 2023 · 0 comments
Open

failed to serialize the context #452

xuefeng-xu opened this issue Jul 6, 2023 · 0 comments
Labels
Type: Bug 🐛 Some functionality not working in the codebase as intended

Comments

@xuefeng-xu
Copy link

Description

Failed to serialize the context when setting the params like this, see the code below.

How to Reproduce

import tenseal as ts

ctx = ts.context(ts.SCHEME_TYPE.CKKS,
                 poly_modulus_degree=32768,
                 coeff_mod_bit_sizes=[35]+[27]*15+[35])
ctx.global_scale = pow(2, 27)
ctx.generate_galois_keys()
ctx.make_context_public()

s = ctx.serialize()

Screenshots

macOS

[libprotobuf ERROR /Users/xxf/code/TenSEAL/build/temp.macosx-11.1-arm64-cpython-38/_deps/protocolbuffers_protobuf-src/src/google/protobuf/message_lite.cc:487] tenseal.TenSEALContextProto exceeded maximum protobuf size of 2GB: 2240338979
Traceback (most recent call last):
  File "test.py", line 10, in <module>
    s = ctx.serialize()
  File "/Users/xxf/miniconda3/envs/ph/lib/python3.8/site-packages/tenseal/enc_context.py", line 189, in serialize
    return self.data.serialize(
ValueError: failed to save proto

Ubuntu

[libprotobuf ERROR /__w/TenSEAL/TenSEAL/build/temp.linux-x86_64-cpython-38/_deps/protocolbuffers_protobuf-src/src/google/protobuf/message_lite.cc:487] tenseal.TenSEALContextProto exceeded maximum protobuf size of 2GB: 2240318631
Traceback (most recent call last):
  File "test.py", line 10, in <module>
    s = ctx.serialize()
  File "/home/xxf/miniconda3/envs/ph/lib/python3.8/site-packages/tenseal/enc_context.py", line 189, in serialize
    return self.data.serialize(
ValueError: failed to save proto

System Information

  • OS: macOS & Linux
  • OS Version: Ventura 13.4.1 & Ubuntu 20.04
  • Language Version: Python 3.8
  • Package Manager Version: Conda 3.4.3

Additional Context

To increase the multiplication depth, the param coeff_mod_bit_sizes is set like this.

@xuefeng-xu xuefeng-xu added the Type: Bug 🐛 Some functionality not working in the codebase as intended label Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐛 Some functionality not working in the codebase as intended
Projects
None yet
Development

No branches or pull requests

1 participant