如何使用Windows上联合的TensorFlow?
我正在尝试使用Tensorflow的教程,使用
。弹出了一些PIP依赖性解析器错误,但是我安装了所需的版本所需的库。
但是,我面临两个问题之一:
- 如果我尝试导入
tensorflow_federated
,它会产生以下错误:
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
- 我找到了一个论坛,建议降级到tensorflow-federated == 0.22。但是,当我这样做并运行导入语句时,它再次引发错误,因为它隐含地导入了KERAS中不再存在的类(Optionizerv1)。
我真的很喜欢TensorFlow的工作流程。是否有使其在Windows上工作的方法?
PS:我在Google Colab和Jupyter笔记本中尝试了它。
I am trying to use Tensorflow's tutorial of doing image classification using Federated Learning over here
Firstly, there were some pip dependency resolver errors popping up, but I installed the required libraries with the versions it asked for.
However, I am facing one of 2 issues:
- If I try to import
tensorflow_federated
, it gives the following error:
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
- I found a forum suggesting to downgrade to tensorflow-federated==0.22. However, when I do that and run the import statement, it throws an error again because it's is implicitly importing a class which is no longer there in Keras (OptimizerV1).
I am really fond of Tensorflow's workflow. Is there any workaround of making it work on Windows?
PS: I tried it in both Google Colab and Jupyter Notebook.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试以下操作:
!PIP安装TensorFlow-Federated == 0.20.0
Try this:
!pip install tensorflow-federated==0.20.0
我相信错误是较旧的Python版本的症状。最新版本的TFF(写作时0.27.0)需要Python 3.9。目前,Colab不支持3.9。参见 https://github.com/tensorflow/tensorflow/federated/federated/issues/issues/2770 以及一些使您可以使用较旧的TFF版本的解决方法。
I believe that error is symptomatic of an older python version. The latest version of TFF (0.27.0 at the time of writing) requires python 3.9. Currently, colab does not support 3.9. See https://github.com/tensorflow/federated/issues/2770 for context and some workarounds that allow you to use older TFF versions.