AttributeError: type object 'Tensor' has no attribute 'fft'
AttributeError: type object 'Tensor' has no attribute 'fft'
当我import syft
时,出现如下错误:
AttributeError: type object 'Tensor' has no attribute 'fft'
我按照 PySyft Doc 安装 syft。
我在 Ubuntu 18.04 和 Google Colab 环境中都尝试了 import syft
。两者都有相同的错误。
Google Colab 的完整错误信息如下,
import syft as sf
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-4-71fdfd268bf5> in <module>()
----> 1 import syft as sf
9 frames
/usr/local/lib/python3.7/dist-packages/syft/__init__.py in <module>()
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
/usr/local/lib/python3.7/dist-packages/syft/core/node/device/__init__.py in <module>()
1 # syft relative
----> 2 from .client import DeviceClient
3 from .device import Device
4
5 __all__ = ["DeviceClient", "Device"]
/usr/local/lib/python3.7/dist-packages/syft/core/node/device/client.py in <module>()
14 from ...io.location import SpecificLocation
15 from ...io.route import Route
---> 16 from ..common.client import Client
17
18
/usr/local/lib/python3.7/dist-packages/syft/core/node/common/client.py in <module>()
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
/usr/local/lib/python3.7/dist-packages/syft/lib/__init__.py in <module>()
24
25 # constructor: copyType = create_lib_ast
---> 26 lib_ast = create_lib_ast()
27 lib_ast._copy = create_lib_ast
/usr/local/lib/python3.7/dist-packages/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()
/usr/local/lib/python3.7/dist-packages/syft/lib/torch/__init__.py in create_torch_ast()
52 continue
53 ast.add_path(
---> 54 path=method, framework_reference=torch, return_type_name=return_type
55 )
56 # add all the torch.nn.Parameter hooks
/usr/local/lib/python3.7/dist-packages/syft/ast/globals.py in add_path(self, path, index, return_type_name, framework_reference)
64 if hasattr(attr, "add_path"):
65 attr.add_path( # type: ignore
---> 66 path=path, index=1, return_type_name=return_type_name
67 )
68
/usr/local/lib/python3.7/dist-packages/syft/ast/module.py in add_path(self, path, index, return_type_name, framework_reference)
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 )
/usr/local/lib/python3.7/dist-packages/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'
有谁知道如何解决这个问题?谢谢。
PySyft 目前不支持 torch 1.8。参见 pysyft issue torch 1.8
pip 安装适用于旧版 pytorch 的较低版本的 pysyft。这样就解决了。
这解决了我的问题
安装手电筒:https://download.pytorch.org/whl/torch_stable.html>(对于cpu 唯一版本)
安装 syft 使用:
当我import syft
时,出现如下错误:
AttributeError: type object 'Tensor' has no attribute 'fft'
我按照 PySyft Doc 安装 syft。
我在 Ubuntu 18.04 和 Google Colab 环境中都尝试了 import syft
。两者都有相同的错误。
Google Colab 的完整错误信息如下,
import syft as sf
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-4-71fdfd268bf5> in <module>()
----> 1 import syft as sf
9 frames
/usr/local/lib/python3.7/dist-packages/syft/__init__.py in <module>()
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
/usr/local/lib/python3.7/dist-packages/syft/core/node/device/__init__.py in <module>()
1 # syft relative
----> 2 from .client import DeviceClient
3 from .device import Device
4
5 __all__ = ["DeviceClient", "Device"]
/usr/local/lib/python3.7/dist-packages/syft/core/node/device/client.py in <module>()
14 from ...io.location import SpecificLocation
15 from ...io.route import Route
---> 16 from ..common.client import Client
17
18
/usr/local/lib/python3.7/dist-packages/syft/core/node/common/client.py in <module>()
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
/usr/local/lib/python3.7/dist-packages/syft/lib/__init__.py in <module>()
24
25 # constructor: copyType = create_lib_ast
---> 26 lib_ast = create_lib_ast()
27 lib_ast._copy = create_lib_ast
/usr/local/lib/python3.7/dist-packages/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()
/usr/local/lib/python3.7/dist-packages/syft/lib/torch/__init__.py in create_torch_ast()
52 continue
53 ast.add_path(
---> 54 path=method, framework_reference=torch, return_type_name=return_type
55 )
56 # add all the torch.nn.Parameter hooks
/usr/local/lib/python3.7/dist-packages/syft/ast/globals.py in add_path(self, path, index, return_type_name, framework_reference)
64 if hasattr(attr, "add_path"):
65 attr.add_path( # type: ignore
---> 66 path=path, index=1, return_type_name=return_type_name
67 )
68
/usr/local/lib/python3.7/dist-packages/syft/ast/module.py in add_path(self, path, index, return_type_name, framework_reference)
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 )
/usr/local/lib/python3.7/dist-packages/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'
有谁知道如何解决这个问题?谢谢。
PySyft 目前不支持 torch 1.8。参见 pysyft issue torch 1.8
pip 安装适用于旧版 pytorch 的较低版本的 pysyft。这样就解决了。
这解决了我的问题
安装手电筒:
https://download.pytorch.org/whl/torch_stable.html>(对于cpu 唯一版本) 安装 syft 使用: