forked from tensorflow/tensor2tensor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
121 lines (115 loc) · 5.02 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
sudo: required
language: python
git:
depth: 3
services:
- docker
python:
- "2.7"
- "3.6"
env:
global:
- T2T_PROBLEM=algorithmic_reverse_binary40_test
- T2T_DATA_DIR=/tmp/t2t-data
- T2T_TRAIN_DIR=/tmp/t2t-train
- TF_LATEST="1.10.*"
# This is necessary to have gsutil work with Python 2.7
- BOTO_CONFIG=/dev/null
matrix:
# We test against recent versions of TensorFlow and tf-nightly.
# If updating, also update TF_LATEST above
- TF_VERSION="1.9.*"
- TF_VERSION="1.10.*"
- TF_VERSION="tf-nightly"
matrix:
exclude:
# We test against all versions in Python 2 but only the latest in Python 3
- python: "3.6"
env: TF_VERSION="1.9.*"
- python: "3.6"
env: TF_VERSION="tf-nightly"
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq libhdf5-dev
install:
- if [[ "$TF_VERSION" == "tf-nightly" ]];
then
pip install tf-nightly;
else
pip install -q "tensorflow==$TF_VERSION";
fi
# First ensure that the base dependencies are sufficient for a full import
- pip install -q .
- t2t-trainer --registry_help
# Then install the test dependencies
- pip install -q .[tests,allen]
# Make sure to install the atari extras for gym
- pip install "gym[atari]"
# Make sure we have the latest version of numpy - avoid problems we were
# seeing with Python 3
- pip install -q -U numpy
script:
# Check import
- python -c "from tensor2tensor.models import transformer; print(transformer.Transformer.__name__)"
# Run tests
# Ignores:
# Tested separately:
# * registry_test
# * trainer_lib_test
# * visualization_test
# * trainer_model_based_test
# * allen_brain_test
# * trainer_model_based_stochastic_test
# * models/research
# algorithmic_math_test: flaky
# universal_transformer_test: requires new feature in tf.foldl (rm with TF 1.9)
- pytest
--ignore=tensor2tensor/utils/registry_test.py
--ignore=tensor2tensor/utils/trainer_lib_test.py
--ignore=tensor2tensor/visualization/visualization_test.py
--ignore=tensor2tensor/bin/t2t_trainer_test.py
--ignore=tensor2tensor/data_generators/algorithmic_math_test.py
--ignore=tensor2tensor/models/research/universal_transformer_test.py
--ignore=tensor2tensor/rl/trainer_model_based_test.py
--ignore=tensor2tensor/data_generators/allen_brain_test.py
--ignore=tensor2tensor/rl/trainer_model_based_stochastic_test.py
--ignore=tensor2tensor/models/research
- pytest tensor2tensor/utils/registry_test.py
- pytest tensor2tensor/utils/trainer_lib_test.py
- pytest tensor2tensor/visualization/visualization_test.py
- pytest tensor2tensor/data_generators/allen_brain_test.py
- if [[ "$TF_VERSION" == "$TF_LATEST" ]] || [[ "$TF_VERSION" == "tf-nightly" ]];
then
pytest tensor2tensor/models/research;
fi
# Run installed scripts
- t2t-datagen 2>&1 | grep translate && echo passed
- t2t-trainer --registry_help
# Test --t2t_usr_dir
- t2t-trainer --registry_help --t2t_usr_dir=./tensor2tensor/test_data/example_usr_dir 2>&1 | grep my_very_own_hparams && echo passed
# Run data generation, training, and decoding on a dummy problem
- t2t-datagen --problem=$T2T_PROBLEM --data_dir=$T2T_DATA_DIR
- t2t-trainer --problem=$T2T_PROBLEM --data_dir=$T2T_DATA_DIR --model=transformer --hparams_set=transformer_tiny --train_steps=5 --eval_steps=5 --output_dir=$T2T_TRAIN_DIR
- t2t-decoder --problem=$T2T_PROBLEM --data_dir=$T2T_DATA_DIR --model=transformer --hparams_set=transformer_tiny --output_dir=$T2T_TRAIN_DIR --decode_hparams='num_samples=10'
# Do some things only on Python 2 and the latest TF version
# Each should be in a separate block to get proper errors on Travis.
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]] && [[ "$TF_VERSION" == "tf-nightly" ]]; then
pylint -j 2 tensor2tensor;
fi
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]] && [[ "$TF_VERSION" == "$TF_LATEST" ]]; then
pytest tensor2tensor/rl/trainer_model_based_test.py;
fi
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]] && [[ "$TF_VERSION" == "$TF_LATEST" ]]; then
jupyter nbconvert --ExecutePreprocessor.timeout=600 --to notebook --execute tensor2tensor/notebooks/hello_t2t.ipynb;
fi
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]] && [[ "$TF_VERSION" == "$TF_LATEST" ]]; then
jupyter nbconvert --ExecutePreprocessor.timeout=600 --to notebook --execute tensor2tensor/notebooks/t2t_problem.ipynb;
fi
# Export and query
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]] && [[ "$TF_VERSION" == "$TF_LATEST" ]]; then
t2t-exporter --problem=$T2T_PROBLEM --data_dir=$T2T_DATA_DIR --model=transformer --hparams_set=transformer_tiny --output_dir=$T2T_TRAIN_DIR;
pip install tensorflow-serving-api;
docker run -d -p 8500:8500 --mount type=bind,source=$T2T_TRAIN_DIR/export/Servo,target=/models/my_model -e MODEL_NAME=my_model -t tensorflow/serving;
sleep 10;
t2t-query-server --problem=$T2T_PROBLEM --server=localhost:8500 --servable_name=my_model --data_dir=$T2T_DATA_DIR --inputs_once='1 0 1 0 1 0';
fi