RuntimeError: keyswitching is not supported by the context
Hi I am doing my master thesis and trained a neural network model. These models and Test Set supposed to be encrypted using BFV FHE Pyfhel. I did validate my contextGen(), output shows Success:valid. But I am experiencing issues saying keyswitching is not supported by the context when the code arrived at he.relinKeyGen(). I don't understand. I read, it said by default BFV Pyfhel does support keyswitching and I don't need to enable anywhere. Please help, I am stucked.
Code To Reproduce Error import Pyfhel self.he = Pyfhel.Pyfhel() self.he.contextGen(scheme="bfv", n=2048, t_bits=14, sec=128) self.he.keyGen() self.he.relinKeyGen()
Traceback (most recent call last):
File "
Setup:
- OS: Kali Linux
- Python: 3.9
- C compiler version: 13.3.0
- Pyfhel Version: 3.4.2
I think the issue might be that you're manually specifying a very small parameter setting (n=2048), and there's just not enough "room" (coefficient modulus q) to do relinearization (a form of keyswitching) with such small parameters. Try either not specifying these values (n, t_bits) or choose larger values (e.g., n=2^13 or 2^14)