属性错误:模块“tensorflow_federated.python.core.backends.native”没有属性“set_remote_python_execution_context”

问题描述 投票:0回答:1

我有以下代码:

import grpc

ip_address = ['0.0.0.0'] * n_workers  #@param {type:"string"}
ports = [80+i for i in range(n_workers)]  #@param {type:list["integer"]}

channels = [grpc.insecure_channel(f'{ip_address[i]}:{ports[i]}') for i in range(len(ports))]
tff.backends.native.set_remote_python_execution_context(channels)

当我运行这部分代码时,我收到此错误:

AttributeError: module 'tensorflow_federated.python.core.backends.native' has no attribute 'set_remote_python_execution_context'

我知道

set_remote_python_execution_context
已被弃用, 但我该如何解决这个问题?

我尝试根据

cpp
已发布的注释使用
tff
执行,但没有一个与
set_remote_python_execution_context
完全相同。

python tensorflow tensorflow-federated federated
1个回答
0
投票

看起来此 API 已在 2023 年 2 月 23 日的

0.50.0
版本 中删除。

要了解安装的版本,请使用:

pip show tensorflow-federated

要使用

0.50.0
之前的版本,请使用:

pip install --force-reinstall "tensorflow-federated==0.49.0"
© www.soinside.com 2019 - 2024. All rights reserved.