Advertisement

构建一个基于Keras和Tensorflow Hub的预训练模型层用于电影评论数据集上的文本分类任务

阅读量:
复制代码
    """"
    使用 Keras 和 Tensorflow Hub 对电影评论进行文本分类
    """
    import numpy as np
    
    import tensorflow as tf
    
    # !pip install tensorflow-hub
    # !pip install tfds-nightly
    import tensorflow_hub as hub
    import tensorflow_datasets as tfds
    
    print("Version: ", tf.__version__)
    print("Eager mode: ", tf.executing_eagerly())
    print("Hub version: ", hub.__version__)
    print("GPU is", "available" if tf.config.experimental.list_physical_devices("GPU") else "NOT AVAILABLE")
    #这里需要保证tensorflow version >= 2.1.0
    
    # 下载IMDB数据集
    train_data, validation_data

全部评论 (0)

还没有任何评论哟~