Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix build in Travis #1137

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,41 @@ language: python

sudo: required

python:
- '2.7'
- '3.6'
matrix:
include:
#- python: 2.7
# dist: xenial # Ubuntu 16.04
# env: TOXENV=py27
- python: 3.5
dist: xenial # Ubuntu 16.04
env: TF_VERSION="tensorflow<2.0"
- python: 3.6
dist: bionic # Ubuntu 18.04
env: TF_VERSION="tensorflow<2.0"
- python: 3.7
dist: bionic # Ubuntu 18.04
env: TF_VERSION="tensorflow<2.0"
- python: 3.6
dist: bionic # Ubuntu 18.04
env: TF_VERSION="tensorflow>=2.0"
- python: 3.7
dist: bionic # Ubuntu 18.04
env: TF_VERSION="tensorflow>=2.0"

cache: pip

install:
# see: https://github.com/fizyr/keras-retinanet/issues/1123#issuecomment-541566486
- pip install $TF_VERSION
- pip install -r requirements.txt
- pip install -r tests/requirements.txt

cache: pip
- pip list

script:
- python setup.py check -m -s
- python setup.py build_ext --inplace
- travis_wait coverage run --source keras_retinanet -m py.test keras_retinanet tests --doctest-modules --forked --flake8
- python setup.py install --dry-run
hgaiser marked this conversation as resolved.
Show resolved Hide resolved
- coverage run --source keras_retinanet -m py.test keras_retinanet tests --doctest-modules --forked --flake8

after_success:
- coverage xml
Expand Down
13 changes: 13 additions & 0 deletions keras_retinanet/backend/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
import tensorflow

# parse the tensorflow version
tf_version = [int(i) for i in tensorflow.__version__.split('.')]
if tf_version[0] >= 2:
# Disable Tensorflow 2.x behavior as we experience issues with it.
# see: https://www.tensorflow.org/api_docs/python/tf/compat/v1/disable_v2_behavior
tensorflow.compat.v1.disable_v2_behavior()
# for cases of using `x.numpy()`
# Aiming: NotImplementedError: numpy() is only available when eager execution is enabled.
# see: https://www.tensorflow.org/api_docs/python/tf/compat/v1/enable_eager_execution
tensorflow.compat.v1.enable_eager_execution()

from .dynamic import * # noqa: F401,F403
from .common import * # noqa: F401,F403
2 changes: 1 addition & 1 deletion tests/models/test_densenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ def test_backbone(backbone):
},
optimizer=keras.optimizers.adam(lr=1e-5, clipnorm=0.001))

model.fit(inputs, targets, batch_size=1)
model.fit(inputs, targets, batch_size=1, epochs=1)
Borda marked this conversation as resolved.
Show resolved Hide resolved