Skip to content

Commit

Permalink
fix requirements and docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
robrua committed Apr 26, 2019
1 parent 81a8171 commit c12efce
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 14 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/robrua/bert/blob/master/LICENSE.txt)
[![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/robrua/easy-bert/blob/master/LICENSE.txt)

# easy-bert
easy-bert is a dead simple API for using Google's high quality BERT language model (https://github.com/google-research/bert).
easy-bert is a dead simple API for using Google's high quality [BERT](https://github.com/google-research/bert) language model.

Currently, easy-bert is focused on getting embeddings from pre-trained BERT models. Support for fine-tuning and pre-training will be added in the future, as well as support for using easy-bert for other tasks besides getting embeddings.

Expand Down Expand Up @@ -63,3 +63,6 @@ bert = Bert.load("/path/to/your/model/")
easy-bert also provides a CLI tool to conveniently do one-off embeddings of sequences with BERT. It can also convert a TensorFlow Hub model to a saved model.

Run `bert --help`, `bert embed --help` or `bert download --help` to get details about the CLI tool.

# Docker
easy-bert comes with a [docker build](https://cloud.docker.com/repository/docker/robrua/easy-bert) that can be used as a base image for applications that rely on bert embeddings or to just run the CLI tool without needing to install an environment.
14 changes: 12 additions & 2 deletions docker/cpu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu18.04 as build
FROM ubuntu:18.04 as build


MAINTAINER Rob Rua <[email protected]>
Expand Down Expand Up @@ -44,12 +44,22 @@ RUN python setup.py install


# Use multi-stage build to minimize image size
FROM ubuntu18.04
FROM ubuntu:18.04


MAINTAINER Rob Rua <[email protected]>


ENV DEBIAN_FRONTEND noninteractive
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8


# Anaconda home setup
ENV CONDA_HOME /opt/conda
ENV PATH $CONDA_HOME/bin:$PATH


COPY --from=build $CONDA_HOME $CONDA_HOME


Expand Down
10 changes: 10 additions & 0 deletions docker/gpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04
MAINTAINER Rob Rua <[email protected]>


ENV DEBIAN_FRONTEND noninteractive
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8


# Anaconda home setup
ENV CONDA_HOME /opt/conda
ENV PATH $CONDA_HOME/bin:$PATH


COPY --from=build $CONDA_HOME $CONDA_HOME


Expand Down
2 changes: 1 addition & 1 deletion easybert/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.0.1
6 changes: 3 additions & 3 deletions requirements-gpu.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
flake8
numpy
tensorflow-gpu
tensorflow-hub
bert-tensorflow
tensorflow-gpu==1.13.1
tensorflow-hub==0.4.0
bert-tensorflow==1.0.1
click
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
flake8
numpy
tensorflow
tensorflow-hub
bert-tensorflow
tensorflow==1.13.1
tensorflow-hub==0.4.0
bert-tensorflow==1.0.1
click
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

install_requires = [
"numpy",
"tensorflow-hub",
"bert-tensorflow",
"tensorflow-hub==0.4.0",
"bert-tensorflow==1.0.1",
"click"
]

# Hacky check for whether CUDA is installed
has_cuda = any("CUDA" in name.split("_") for name in os.environ.keys())
install_requires.append("tensorflow-gpu" if has_cuda else "tensorflow")
install_requires.append("tensorflow-gpu==1.13.1" if has_cuda else "tensorflow==1.13.1")

version_file = Path(__file__).parent.joinpath("easybert", "VERSION.txt")
version = version_file.read_text(encoding="UTF-8").strip()
Expand Down

0 comments on commit c12efce

Please sign in to comment.