[英]How to tune hyper parameters for CIFAR100 in tensorflow_federated TFF without dropping in the accuracy?
[英]import tensorflow_federated as tff error in google colab
您好,我正在使用 google colab,我在將 tensorflow_federated 導入為 tff 時遇到問題,它之前運行良好,我不知道現在是什么問題。
這是我的代碼:我安裝了所有 nessacery pip 庫,並且在 tff 的 0.20.0 版中一切正常。 我也嘗試安裝最新版本 0.33.0,但它不起作用任何人都可以幫助我,請問出了什么問題???
!pip install --quiet --upgrade tensorflow-federated
!pip install --quiet --upgrade tensorflow-model-optimization
!pip install --quiet --upgrade nest-asyncio
import nest_asyncio
nest_asyncio.apply()
%load_ext tensorboard
!pip install h5py
!pip install typing-extensions
!pip install wheel
!pip install tensorflow
!pip install --quiet tensorflow-federated==0.20.0
這是我的進口商品:
import pandas as pd
import collections
import numpy as np
np.random.seed(0)
import tensorflow as tf
from tensorflow.python.keras.optimizer_v2 import gradient_descent
import tensorflow_federated as tff
from random import choices
import matplotlib.pyplot as plt
from google.colab import drive
import functools
from absl import app
from absl import flags
from absl import logging
import abc
from typing import Any, Callable, Iterable, List, Optional, Sequence, Tuple, Union
from tensorflow_federated.python.common_libs import py_typecheck
這是我嘗試導入 tff 時的錯誤:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-17-bcd46adc5a91> in <module>
5 import tensorflow as tf
6 from tensorflow.python.keras.optimizer_v2 import gradient_descent
----> 7 import tensorflow_federated as tff
8 from random import choices
9 import matplotlib.pyplot as plt
/usr/local/lib/python3.7/dist-packages/tensorflow_federated/__init__.py in <module>
79 # the directory structure. The python import statements above implicitly add
80 # these to locals().
---> 81 del python # pylint:disable=undefined-variable
82 del proto # pylint:disable=undefined-variable
NameError: name 'python' is not defined
當我嘗試第一個 pip 時也出現錯誤:
錯誤:pip 的依賴項解析器當前未考慮所有已安裝的包。 此行為是以下依賴項沖突的根源。 pymc 4.1.4 要求 cachetools>=4.2.1,但您有不兼容的 cachetools 3.1.1。 grpcio-status 1.48.2 要求 grpcio>=1.48.2,但是您有不兼容的 grpcio 1.46.5。 google-colab 1.0.0 需要 portpicker~=1.3.1,但您有不兼容的 portpicker 1.5.2。 google-cloud-bigquery 3.3.6 需要 grpcio<2.0dev,>=1.47.0,但您有不兼容的 grpcio 1.46.5。
如此處的文檔中所述Tff tutorials
據說 tff 需要 Python 3.9,而 Google Colab 當前版本在 Python 3.8.16 上運行
您可以嘗試在本地機器上運行它,或者將 python colab 版本升級到 3.9—— 這里是如何升級
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.