OpenMined / SyferText

A privacy preserving NLP framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error

Kevin-Lakhani opened this issue · comments


AttributeError Traceback (most recent call last)
in
----> 1 import syft

c:\users\dell\appdata\local\programs\python\python38\lib\site-packages\syft-0.3.0-py3.8.egg\syft_init_.py in
59 from syft.core.common.serde.serialize import _serialize as serialize # noqa: F401
60 from syft.core.node.common.service.repr_service import ReprMessage # noqa: F401
---> 61 from syft.core.node.device.device import Device # noqa: F401
62 from syft.core.node.device.device import DeviceClient # noqa: F401
63 from syft.core.node.domain.domain import Domain # noqa: F401

c:\users\dell\appdata\local\programs\python\python38\lib\site-packages\syft-0.3.0-py3.8.egg\syft\core\node\device_init_.py in
1 # syft relative
----> 2 from .client import DeviceClient
3 from .device import Device
4
5 all = ["DeviceClient", "Device"]

c:\users\dell\appdata\local\programs\python\python38\lib\site-packages\syft-0.3.0-py3.8.egg\syft\core\node\device\client.py in
14 from ...io.location import SpecificLocation
15 from ...io.route import Route
---> 16 from ..common.client import Client
17
18

c:\users\dell\appdata\local\programs\python\python38\lib\site-packages\syft-0.3.0-py3.8.egg\syft\core\node\common\client.py in
18 from ....core.pointer.pointer import Pointer
19 from ....decorators import syft_decorator
---> 20 from ....lib import lib_ast
21 from ....proto.core.node.common.client_pb2 import Client as Client_PB
22 from ....proto.core.node.common.metadata_pb2 import Metadata as Metadata_PB

c:\users\dell\appdata\local\programs\python\python38\lib\site-packages\syft-0.3.0-py3.8.egg\syft\lib_init_.py in
24
25 # constructor: copyType = create_lib_ast
---> 26 lib_ast = create_lib_ast()
27 lib_ast._copy = create_lib_ast

c:\users\dell\appdata\local\programs\python\python38\lib\site-packages\syft-0.3.0-py3.8.egg\syft\lib_init_.py in create_lib_ast()
10
11 python_ast = create_python_ast()
---> 12 torch_ast = create_torch_ast()
13 torchvision_ast = create_torchvision_ast()
14 # numpy_ast = create_numpy_ast()

c:\users\dell\appdata\local\programs\python\python38\lib\site-packages\syft-0.3.0-py3.8.egg\syft\lib\torch_init_.py in create_torch_ast()
51 # this allows us to import them for testing
52 continue
---> 53 ast.add_path(
54 path=method, framework_reference=torch, return_type_name=return_type
55 )

c:\users\dell\appdata\local\programs\python\python38\lib\site-packages\syft-0.3.0-py3.8.egg\syft\ast\globals.py in add_path(self, path, index, return_type_name, framework_reference)
63 attr = self.attrs[framework_name]
64 if hasattr(attr, "add_path"):
---> 65 attr.add_path( # type: ignore
66 path=path, index=1, return_type_name=return_type_name
67 )

c:\users\dell\appdata\local\programs\python\python38\lib\site-packages\syft-0.3.0-py3.8.egg\syft\ast\module.py in add_path(self, path, index, return_type_name, framework_reference)
118 self.lookup_cache[attr_ref] = path
119 if hasattr(attr, "add_path"):
--> 120 attr.add_path( # type: ignore
121 path=path, index=index + 1, return_type_name=return_type_name
122 )

c:\users\dell\appdata\local\programs\python\python38\lib\site-packages\syft-0.3.0-py3.8.egg\syft\ast\callable.py in add_path(self, path, index, return_type_name)
80 if path[index] not in self.attrs:
81
---> 82 attr_ref = getattr(self.ref, path[index])
83
84 if isinstance(attr_ref, module_type):

AttributeError: type object 'Tensor' has no attribute 'fft'

@Kevin-Lakhani I believe the version you are using for torch is not compatible with the syft version.
This could be solved by downgrading torch version.
pip install torch==1.7.0

PS: This would be taken care in new version of syft. (PR that fixed the issue).

I am not sure I understand the error and the code which is creating it. It would be helpful if you could add the following in comments

  1. Torch Version
  2. Syft version
  3. code
  4. Error

I believe you are referring to documentation of an older version (0.2-)

You can import string class like this

from syft.lib.python import String

Let me know if this solved the import issue

Can you help me to find the documentation of Pysyft(0.3.0)

Latest documentation for syft

No attribute TorchHook

As mentioned here we no longer need to Hook libraries like torch, so for versions 0.3+, I believe you could remove the line and code would work fine.

You can also see examples present in the repo (example)

Notice you no longer need to hook torch

Cheers!!

@Param-29 @Kevin-Lakhani the setup script is currently being updated. This SyferText version is supposed to work with Syft's Dev branch. We are working on the script. But you can still use SyferText if you just install Syft's Dev branch.