This repository has been archived by the owner on Mar 3, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
194 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,29 @@ | ||
dist: xenial | ||
language: python | ||
python: | ||
- "2.7" | ||
- "3.6" | ||
python: "3.6" | ||
env: | ||
global: | ||
- COVERALLS_PARALLEL=true | ||
matrix: | ||
- KERAS_BACKEND=tensorflow | ||
- KERAS_BACKEND=tensorflow TF_KERAS=1 | ||
install: | ||
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; | ||
- bash miniconda.sh -b -p $HOME/miniconda | ||
- export PATH="$HOME/miniconda/bin:$PATH" | ||
- conda config --set always_yes yes --set changeps1 no | ||
- conda update -q conda | ||
- conda info -a | ||
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION | ||
- source activate test-environment | ||
- export LD_LIBRARY_PATH=$HOME/miniconda/envs/test-environment/lib/:$LD_LIBRARY_PATH | ||
- pip install --upgrade pip | ||
- pip install numpy | ||
- pip install tensorflow | ||
- pip install keras | ||
- pip install pycodestyle | ||
- pip install coverage | ||
- pip install -r requirements.txt | ||
- pip install -r requirements-dev.txt | ||
- pip install coveralls | ||
- pip install keras-bi-lm | ||
before_script: | ||
- bash lint.sh | ||
script: | ||
- bash test.sh | ||
- ./test.sh | ||
after_success: | ||
coveralls | ||
notifications: | ||
webhooks: https://coveralls.io/webhook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
from .model import BiLM | ||
from .model import * | ||
|
||
__version__ = '0.24.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import os | ||
from distutils.util import strtobool | ||
|
||
__all__ = [ | ||
'keras', 'utils', 'activations', 'applications', 'backend', 'datasets', | ||
'layers', 'preprocessing', 'wrappers', 'callbacks', 'constraints', 'initializers', | ||
'metrics', 'models', 'losses', 'optimizers', 'regularizers', 'TF_KERAS', | ||
] | ||
|
||
TF_KERAS = strtobool(os.environ.get('TF_KERAS', '0')) | ||
|
||
if TF_KERAS: | ||
import tensorflow as tf | ||
keras = tf.keras | ||
else: | ||
import keras | ||
|
||
utils = keras.utils | ||
activations = keras.activations | ||
applications = keras.applications | ||
backend = keras.backend | ||
datasets = keras.datasets | ||
layers = keras.layers | ||
preprocessing = keras.preprocessing | ||
wrappers = keras.wrappers | ||
callbacks = keras.callbacks | ||
constraints = keras.constraints | ||
initializers = keras.initializers | ||
metrics = keras.metrics | ||
models = keras.models | ||
losses = keras.losses | ||
optimizers = keras.optimizers | ||
regularizers = keras.regularizers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ wheel>=0.31.0 | |
tensorflow | ||
coverage | ||
nose | ||
pycodestyle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
#!/usr/bin/env bash | ||
nosetests --with-coverage --cover-html --cover-html-dir=htmlcov --cover-package="keras_bi_lm" tests | ||
pycodestyle --max-line-length=120 keras_bi_lm tests && \ | ||
nosetests --nocapture --with-coverage --cover-erase --cover-html --cover-html-dir=htmlcov --cover-package=keras_bi_lm --with-doctest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
import os | ||
import unittest | ||
import tempfile | ||
from keras_bi_lm import BiLM | ||
|
||
|
||
class TestSaveLoad(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.tmp_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tmp') | ||
if not os.path.exists(self.tmp_path): | ||
os.makedirs(self.tmp_path) | ||
|
||
def test_save_load(self): | ||
model_path = os.path.join(self.tmp_path, 'save_load.h5') | ||
model = BiLM(token_num=101) | ||
model.save_model(model_path) | ||
model.load_model(model_path) | ||
with tempfile.TemporaryDirectory() as temp_path: | ||
model_path = os.path.join(temp_path, 'save_load.h5') | ||
model = BiLM(token_num=101) | ||
model.save_model(model_path) | ||
model.load_model(model_path) | ||
|
||
def test_init_load(self): | ||
model_path = os.path.join(self.tmp_path, 'save_load.h5') | ||
model = BiLM(token_num=101) | ||
model.save_model(model_path) | ||
BiLM(model_path=model_path) | ||
with tempfile.TemporaryDirectory() as temp_path: | ||
model_path = os.path.join(temp_path, 'save_load.h5') | ||
model = BiLM(token_num=101) | ||
model.save_model(model_path) | ||
BiLM(model_path=model_path) |
Oops, something went wrong.