我正在尝试从pysyft(https://github.com/OpenMined/PySyft/blob/dev/examples/tutorials/advanced/websockets-example-MNIST-parallel/Asynchronous-federated-learning-on-MNIST.ipynb)运行联合学习,该学习创建远程工作者并通过websocket连接到他们。但是在遵循评估步骤时出现错误。

future: <Task finished coro=<WebsocketServerWorker._producer_handler() done, defined at C:\Users\Public\Anaconda\lib\site-packages\syft\workers\websocket_server.py:95> exception=AttributeError("'dict' object has no attribute 'owner'")>
Traceback (most recent call last):
  File "C:\Users\Public\Anaconda\lib\site-packages\syft\generic\frameworks\hook\hook_args.py", line 663, in register_response
    register_response_function = register_response_functions[attr_id]
KeyError: 'evaluate'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Public\Anaconda\lib\site-packages\syft\workers\websocket_server.py", line 113, in _producer_handler
    response = self._recv_msg(message)
  File "C:\Users\Public\Anaconda\lib\site-packages\syft\workers\websocket_server.py", line 124, in _recv_msg
    return self.recv_msg(message)
  File "C:\Users\Public\Anaconda\lib\site-packages\syft\workers\base.py", line 310, in recv_msg
    response = self._message_router[type(msg)](msg.contents)
  File "C:\Users\Public\Anaconda\lib\site-packages\syft\workers\base.py", line 457, in execute_command
    command_name, response, list(return_ids), self
  File "C:\Users\Public\Anaconda\lib\site-packages\syft\generic\frameworks\hook\hook_args.py", line 672, in register_response
    new_response = register_response_function(response, response_ids=response_ids, owner=owner)
  File "C:\Users\Public\Anaconda\lib\site-packages\syft\generic\frameworks\hook\hook_args.py", line 766, in <lambda>
    return lambda x, **kwargs: f(lambdas, x, **kwargs)
  File "C:\Users\Public\Anaconda\lib\site-packages\syft\generic\frameworks\hook\hook_args.py", line 522, in two_fold
    return lambdas[0](args[0], **kwargs), lambdas[1](args[1], **kwargs)
  File "C:\Users\Public\Anaconda\lib\site-packages\syft\generic\frameworks\hook\hook_args.py", line 744, in <lambda>
    else lambda i, **kwargs: register_tensor(i, **kwargs)
  File "C:\Users\Public\Anaconda\lib\site-packages\syft\generic\frameworks\hook\hook_args.py", line 712, in register_tensor
    tensor.owner = owner
AttributeError: 'dict' object has no attribute 'owner'


他们的论坛中没有明确的答案。有没有人知道此脚本中的问题是什么?

我的syft版本:

syft : 0.2.3a1
syft-proto : 0.1.1a1.post12
torch : 1.4.0

最佳答案

我也遇到了这个问题,并在https://github.com/OpenMined/PySyft/pull/2948中推送了一个修复程序

关于python - Pysyft联合学习,Websockets错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/60202610/

10-10 15:38