Pycharm 使用 tensorflow_datasets 错误 【Failed to construct dataset ...】

tensorflow-datasets 版本 : 2.1.0

import tensorflow_datasets as tfds

datasets, info = tfds.load('imdb_reviews/subwords8k', with_info=True, as_supervised=True)

报错:Failed to construct dataset imdb_reviews

增加一行代码即可:

_is_gcs_disabled = False

tfds.load( ) 还可以添加的参数:

Some common arguments:

  • split=: Which split to read (e.g. 'train'['train', 'test']'train[80%:]',...). See our split API guide.
  • shuffle_files=: Control whether to shuffle the files between each epoch (TFDS store big datasets in multiple smaller files).
  • data_dir=: Location where the dataset is saved ( defaults to ~/tensorflow_datasets/),设定下载文件夹,默认为 ~/tensorflow_datasets/
  • with_info=True: Returns the tfds.core.DatasetInfo containing dataset metadata
  • download=False: Disable download, 如果本地存在,可以直接读取,不下载

来源官网:https://www.tensorflow.org/datasets/overview

你可能感兴趣的:(TensorFlow,python,pycharm,tensorflow)