我是Federated Learning的新手。我试着从Colab上的tutorial“联合学习图像分类”开始,但遇到了一些问题。当我安装TensorFlow和TensorFlow联邦时,
#@test {"skip": true}
# tensorflow_federated_nightly also bring in tf_nightly, which
# can causes a duplicate tensorboard install, leading to errors.
!pip uninstall --yes tensorboard tb-nightly
!pip install --quiet --upgrade tensorflow-federated-nightly
!pip install --quiet --upgrade nest-asyncio
!pip install --quiet --upgrade tb-nightly # or tensorboard, but not both
import nest_asyncio
nest_asyncio.apply()出现了一些错误
ERROR: tensorflow 2.5.0 requires tensorboard~=2.5, which is not installed.
ERROR: tensorflow 2.5.0 has requirement grpcio~=1.34.0, but you'll have grpcio 1.37.1 which is incompatible.
ERROR: tensorflow 2.5.0 has requirement keras-nightly~=2.5.0.dev, but you'll have keras-nightly 2.7.0.dev2021071300 which is incompatible.
ERROR: spacy 2.2.4 has requirement tqdm<5.0.0,>=4.38.0, but you'll have tqdm 4.28.1 which is incompatible.
ERROR: pymc3 3.11.2 has requirement cachetools>=4.2.1, but you'll have cachetools 3.1.1 which is incompatible.
ERROR: fbprophet 0.7.1 has requirement tqdm>=4.36.1, but you'll have tqdm 4.28.1 which is incompatible.
ERROR: datascience 0.10.6 has requirement folium==0.2.1, but you'll have folium 0.8.3 which is incompatible.
ERROR: tensorflow-privacy 0.6.1 has requirement attrs>=21.2.0, but you'll have attrs 19.3.0 which is incompatible.我看到一些关于这些错误的类似的question,然后运行其余的单元。然而,当涉及到代码时
import collections
import numpy as np
import tensorflow as tf
import tensorflow_federated as tff错误再次出现:
ImportError Traceback (most recent call last) <ipython-input-3-a23308ec3f7c> in <module>()
3 import numpy as np
4 import tensorflow as tf
----> 5 import tensorflow_federated as tff
6
7 np.random.seed(0)
28 frames
/usr/local/lib/python3.7/dist-packages/keras/api/_v2/keras/__init__.py in <module>()
8 import sys as _sys
9
---> 10 from keras import __version__
11 from keras.api._v2.keras import __internal__
12 from keras.api._v2.keras import activations
ImportError: cannot import name '__version__' from 'keras' (/usr/local/lib/python3.7/dist-packages/keras/__init__.py)我不熟悉TensorFlow联邦。其他人有没有遇到过同样的问题?需要指针来解决这个问题。
发布于 2021-07-20 13:33:26
从一个干净的运行时开始,并添加一个包含以下内容的代码部分:
!pip uninstall tensorflow keras -y在运行其他任何东西之前先运行它,然后重新启动运行时。然后,您可以运行本教程的其余部分。
https://stackoverflow.com/questions/68380729
复制相似问题