如何使用Windows上联合的TensorFlow?

发布于 2025-02-04 13:21:19 字数 661 浏览 6 评论 0原文

我正在尝试使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

放低过去 2025-02-11 13:21:19

尝试以下操作:

!PIP安装TensorFlow-Federated == 0.20.0

Try this:

!pip install tensorflow-federated==0.20.0

桃气十足 2025-02-11 13:21:19

我相信错误是较旧的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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文