Skip to content

vineetm/tfhub-bert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tfhub-bert

  1. Setup local cache directory for tensorflow hub

    mkdir "${HOME}/tf-hub-cache"
    
    cp ~/.bash_profile ~/.bash_profile.bkup
    echo 'export TFHUB_CACHE_DIR="${HOME}/tf-hub-cache"' >> ~/.bash_profile
    source "${HOME}/.bash_profile"
    
    echo $TFHUB_CACHE_DIR
  2. Create a new conda environment (let's call it bert) and install requirements

    conda create -n bert python=3.7
    source activate bert
    
    (bert) pip install -r requirements.txt

    NOTE: if source activate bert does not work, try conda activate bert

  3. Download a Bert Model, and copy vocab file. Feel free to replace BERT URL form list of available modules. You would also need to change the local vocab path accordingly.

    python download_bert.py
    cp $TFHUB_CACHE_DIR/ecd2596ce849110246602e3d4d81e2d9719cb027/assets/vocab.txt .
  4. Get tokenization.py from the official BERT repository

  5. Start jupyter

    jupyter notebook

About

Loading Bert using Tensorflow Hub

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors