最屌NLP——-BERT之安装篇

版权声明:本文为博主原创文章,欢迎转载,转载请注明作者、原文超链接 https://blog.csdn.net/u013220482/article/details/86716158

bert目前官方提供tensorflow、keras版本、目前github上也有其他版本的,本文以tensorflow版本为准,环境管理采用anaconda管理。

1、Anaconda环境安装

  • tensorflow环境配置
conda create -n tensorflow python=3.5
  • 设置下载通道
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

2、tensorflow环境安装

  • 激活环境并安装tensorflow
source activate tensorflow
pip install tensorflow
  • 确保tensorflow安装成功
import tensorflow as tf
s=tf.constant(1)

3、bert安装

3.1 从github源码安装

点击下载github源码
直接解压上面就可以使用

3.2 从pypi上安装

这里采用从pypi上安装,可以方便代码的管理,安装方式如下

pip install bert-tensorflow

输入下面代码确认

from bert import modeling

猜你喜欢

转载自blog.csdn.net/u013220482/article/details/86716158