I'm trying to decrypt a model that I have trained with shared encrypted data. And save it so I can then load it into another script and do evaluations on the model in plain text.
The code I'm using for decrypting and saving is:
model = encrypted_model.decrypt()
crypten.save_from_party(model, f'modelrank{rank}.pth', src=rank)
And for loading on a separate script:
model = crypten.load_from_party('model_rank_0.pth', src=0)
But I get this error:
Traceback (most recent call last):
File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, *self._kwargs)
File "/mnt/c/Users/a2588/.local/lib/python3.8/site-packages/crypten/mpc/context.py", line 30, in _launch
return_value = func(func_args, **func_kwargs)
File "load_and_inference.py", line 53, in encrypt_model_and_data
model = crypten.load_from_party('model_rank_0.pth', src=0)
File "/mnt/c/Users/a2588/.local/lib/python3.8/site-packages/crypten/init.py", line 345, in load_from_party
raise TypeError("Unrecognized load type %s" % type(result))
TypeError: Unrecognized load type <class 'int'>
I have not seen example with using model.decrypt but only with decrypting tensors via get_plain_text().
Any example provided or help with the error I can't crearly identify would be a great help!
I'm trying to decrypt a model that I have trained with shared encrypted data. And save it so I can then load it into another script and do evaluations on the model in plain text.
The code I'm using for decrypting and saving is:
model = encrypted_model.decrypt() crypten.save_from_party(model, f'modelrank{rank}.pth', src=rank)
And for loading on a separate script:
model = crypten.load_from_party('model_rank_0.pth', src=0)
But I get this error:
Traceback (most recent call last): File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, *self._kwargs) File "/mnt/c/Users/a2588/.local/lib/python3.8/site-packages/crypten/mpc/context.py", line 30, in _launch return_value = func(func_args, **func_kwargs) File "load_and_inference.py", line 53, in encrypt_model_and_data model = crypten.load_from_party('model_rank_0.pth', src=0) File "/mnt/c/Users/a2588/.local/lib/python3.8/site-packages/crypten/init.py", line 345, in load_from_party raise TypeError("Unrecognized load type %s" % type(result)) TypeError: Unrecognized load type <class 'int'>
I have not seen example with using model.decrypt but only with decrypting tensors via get_plain_text().
Any example provided or help with the error I can't crearly identify would be a great help!