incompatible with PyTorch 1.9
See original GitHub issueI understand I should use a lower grade version of PyTorch. I just want to use CrypTen to compute the inner product. Can anyone help me to fix it with a few efforts? Really appreciate it! Thanks!
My env: torch 1.9.0
, torchvision 0.10.0
Here is the code
import torch
import crypten
crypten.init()
x = torch.tensor([1.0, 2.0, 3.0])
x_enc = crypten.cryptensor(x) # encrypt
z_enc = x_enc.dot(x_enc)
And the error
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/tmp/ipykernel_31576/2452821068.py in <module>
5 x = torch.tensor([1.0, 2.0, 3.0])
6 x_enc = crypten.cryptensor(x) # encrypt
----> 7 z_enc = x_enc.dot(x_enc)
8 print(z_enc.get_plain_text())
~/.conda/envs/py38/lib/python3.8/site-packages/crypten/mpc/mpc.py in convert_wrapper(self, *args, **kwargs)
40 def convert_wrapper(self, *args, **kwargs):
41 result = self.to(ptype)
---> 42 return func(result, *args, **kwargs)
43
44 return convert_wrapper
~/.conda/envs/py38/lib/python3.8/site-packages/crypten/mpc/mpc.py in ob_wrapper_function(self, value, *args, **kwargs)
1141 if isinstance(value, CrypTensor):
1142 value = value._tensor
-> 1143 result._tensor = getattr(result._tensor, name)(value, *args, **kwargs)
1144 return result
1145
~/.conda/envs/py38/lib/python3.8/site-packages/crypten/mpc/primitives/arithmetic.py in dot(self, y, weights)
509 result = self.clone()
510
--> 511 return result.mul_(y).sum()
512
513 def ger(self, y):
~/.conda/envs/py38/lib/python3.8/site-packages/crypten/mpc/primitives/arithmetic.py in mul_(self, y)
281 self.share *= y
282 return self
--> 283 return self._arithmetic_function_(y, "mul")
284
285 def div(self, y):
~/.conda/envs/py38/lib/python3.8/site-packages/crypten/mpc/primitives/arithmetic.py in _arithmetic_function_(self, y, op, *args, **kwargs)
188
189 def _arithmetic_function_(self, y, op, *args, **kwargs):
--> 190 return self._arithmetic_function(y, op, inplace=True, *args, **kwargs)
191
192 def _arithmetic_function(self, y, op, inplace=False, *args, **kwargs):
~/.conda/envs/py38/lib/python3.8/site-packages/crypten/mpc/primitives/arithmetic.py in _arithmetic_function(self, y, op, inplace, *args, **kwargs)
244 else: # scale by larger of self.encoder.scale and y.encoder.scale
245 if self.encoder.scale > 1 and y.encoder.scale > 1:
--> 246 return result.div_(result.encoder.scale)
247 elif self.encoder.scale > 1:
248 result.encoder = self.encoder
~/.conda/envs/py38/lib/python3.8/site-packages/crypten/mpc/primitives/arithmetic.py in div_(self, y)
310 self -= wraps * 4 * (int(2 ** 62) // y)
311 else:
--> 312 self.share /= y
313 return self
314
RuntimeError: result type Float can't be cast to the desired output type Long
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
PyTorch v1.9.0 is not compatible with CUDA 11.3? - windows
According to the official installation instruction (https://pytorch.org/get-started/previous-versions/), 1.9.0 should be compatible with CUDA ...
Read more >How does one install pytorch 1.9 in an HPC that seems to ...
I've been trying to install PyTorch 1.9 with Cuda (ideally 11) on my HPC but I cannot. The cluster says: Package typing-extensions conflicts ......
Read more >Cuda not compatible with PyTorch installation error while ...
I implemented conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch , and export to yml file.
Read more >solve: MAGMA library not found in compilation. Please rebuild ...
I'm using fastai and I see on PyTorch boards that it has to do with Conda installs ... in the new Kaggle environment...
Read more >Installation — pytorch_geometric documentation
0/1.7.1, PyTorch 1.8.0/1.8.1, PyTorch 1.9.0, PyTorch 1.10.0/1.10.1/1.10.2,a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ZJG0 Thanks! For some reason, there is no
configs/default.yaml
in the rebuilt version. So, I manually added this file. Anyway, it works now! Thanks for your help!Closing since this seems to be resolved.