我正在尝试运行colab上的Tensorflow联邦教程。
但是,到目前为止,from tensorflow_federated import python as tff代码给出了以下错误:
TypeError Traceback (most recent call last)
<ipython-input-3-af7e4c5121d6> in <module>()
1 import tensorflow as tf
----> 2 from tensorflow_federated import python as tff
6 frames
/usr/local/lib/python3.7/dist-packages/tensorflow_federated/python/common_libs/structure.py in <module>()
263
264 def to_odict(struct: Struct,
--> 265 recursive: bool = False) -> collections.OrderedDict[str, Any]:
266 """Returns `struct` as an `OrderedDict`, if possible.
267
TypeError: 'type' object is not subscriptable任何建议都将不胜感激。耽误您时间,实在对不起。
发布于 2022-07-17 05:25:29
TFF最近的版本只兼容Python3.9和更高版本;Google的托管运行时仍然在Python3.7上。
运行这些笔记本的最快方法可能是使用Python3.9运行您自己的本地运行时,并在那里连接这些笔记本;从Colab中可以找到有关如何从Colab执行此操作的说明这里。
https://stackoverflow.com/questions/73007445
复制相似问题