0

在 syft 上使用 keras 训练模型联邦学习时,启动不同系统上的工作人员作为客户端工作人员,在终端上执行特定的命令行。

python -m tf_encrypted.player --config /tmp/tfe.config client name

此命令应在我的客户工作者之一的系统上执行。执行代码时

(PySyft) C:\Users\mades>python -m tf_encrypted.player --config /tmp/tfe.config server1
Falling back to insecure randomness since the required custom op could not be found for the installed version of TensorFlow. Fix this by compiling custom ops. Missing file was 'C:\Users\mades\AppData\Roaming\Python\Python37\site-packages\tf_encrypted/operations/secure_random/secure_random_module_tf_1.15.2.so'
WARNING:tensorflow:From C:\Users\mades\AppData\Roaming\Python\Python37\site-packages\tf_encrypted\session.py:24: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

Traceback (most recent call last):
  File "C:\Users\mades\Anaconda3\envs\PySyft\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\mades\Anaconda3\envs\PySyft\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\mades\AppData\Roaming\Python\Python37\site-packages\tf_encrypted\player\__main__.py", line 22, in <module>
    config = RemoteConfig.load(args.config)
  File "C:\Users\mades\AppData\Roaming\Python\Python37\site-packages\tf_encrypted\config.py", line 221, in load
    with open(filename, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tfe.config'

如何在这个系统上准备联邦学习的配置文件?

4

1 回答 1

0

You don't need to create /tmp/tfe.config. It is automatically created when cluster is started. I mean when below command is executed.

cluster.start()

Let say your cluster is:

alice = sy.TFEWorker(host='192.168.1.120:4000', auto_managed=True)
bob = sy.TFEWorker(host='192.168.1.120:4001', auto_managed=True)
carol = sy.TFEWorker(host='192.168.1.120:4002', auto_managed=True)

cluster = sy.TFECluster(alice, bob, carol)
cluster.start()

A typical structure of /tmp/tfe.config is given below

{
"server0": "192.168.1.120:4000", 
"server1": "192.168.1.120:4001", 
"server2": "192.168.1.120:4002"
}

Now you may run below commands in three different sessions.

python -m tf_encrypted.player --config /tmp/tfe.config server0
python -m tf_encrypted.player --config /tmp/tfe.config server1
python -m tf_encrypted.player --config /tmp/tfe.config server2
于 2020-07-31T17:44:32.117 回答