diff --git a/.circleci/config.yml b/.circleci/config.yml index da13fac..f791c22 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,12 +13,14 @@ jobs: name: install Debian dependencies command: | sudo apt-get update - sudo apt-get install gfortran libblas3 liblapack3 cmake + sudo apt-get install gfortran libopenblas-dev liblapack-dev cmake - run: name: setup Python venv command: | python3 -m venv venv + . venv/bin/activate + pip install --upgrade pip - run: name: PolyChord install @@ -26,9 +28,8 @@ jobs: . venv/bin/activate git clone https://github.com/PolyChord/PolyChordLite PolyChord cd PolyChord - make MPI= pypolychord - pip install numpy - python setup.py install + pip install numpy scipy + pip install . --global-option="--no-mpi" cd .. - run: @@ -66,12 +67,6 @@ jobs: . venv/bin/activate flake8 pybambi tests - - run: - name: sphinx-build - command: | - . venv/bin/activate - sphinx-build docs/source docs/build -nW - - run: name: pydocstyle command: | diff --git a/.travis.yml b/.travis.yml index 3fdc378..37d3076 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,20 @@ # linux matrix -#language: python -#os: linux -#python: -# - "3.7" -# - "3.6" -# - "3.5" -#env: -# - MPI= -# - MPI=1 +language: python +os: linux +python: + - "3.8" + - "3.7" + - "3.6" +env: + - MPI=0 + - MPI=1 # OSX matrix matrix: include: - os: osx language: sh - env: TOXENV=py3 MPI= + env: TOXENV=py3 MPI=0 # System packages addons: @@ -38,19 +38,21 @@ before_install: pip3 install virtualenv; virtualenv -p python3 ~/venv; source ~/venv/bin/activate; + pip install --upgrade pip; pip install --upgrade "https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.1.0-cp37-cp37m-macosx_10_9_x86_64.whl"; fi + - pip install --upgrade pip + # PolyChord install - pip install numpy - git clone https://github.com/PolyChord/PolyChordLite PolyChord - cd PolyChord - - make MPI=$MPI pypolychord - - if [ "$MPI" ]; then - CC=mpicc CXX=mpicxx python setup.py install; + - if [ "$MPI" -eq 1 ]; then + pip install . ; else - python setup.py install; - fi + pip install . --global-option="--no-mpi"; + fi; - cd .. # MultiNest install @@ -59,7 +61,7 @@ before_install: - mkdir -p MultiNest/build - cd MultiNest/build - cmake .. - - if [ "$MPI" ]; then + - if [ "$MPI" -eq 1 ]; then make multinest_mpi_shared; else make multinest_shared; @@ -79,7 +81,7 @@ install: - pip install -r requirements.txt - pip install pytest-cov codecov - pip install flake8 pydocstyle sphinx sphinx_rtd_theme - - if [ "$MPI" ]; then pip install mpi4py; fi + - if [ "$MPI" -eq 1 ]; then pip install mpi4py; fi before_script: # Test for pep-compliance @@ -93,7 +95,7 @@ before_script: # Run tests script: - - if [ "$MPI" ]; + - if [ "$MPI" -eq 1 ]; then mpirun -np 2 python -m pytest tests; else python -m pytest tests --cov=pybambi; fi diff --git a/pybambi/manager.py b/pybambi/manager.py index 3c23659..5c0c0af 100644 --- a/pybambi/manager.py +++ b/pybambi/manager.py @@ -9,7 +9,7 @@ from pybambi.neuralnetworks.kerasnet import KerasNetInterpolation from pybambi.neuralnetworks.nearestneighbour \ import NearestNeighbourInterpolation -import keras.models +import tensorflow.keras.models class BambiManager(object): @@ -44,7 +44,7 @@ def make_learner(self, params, loglikes): return KerasNetInterpolation(params, loglikes) elif self._learner == 'nearestneighbour': return NearestNeighbourInterpolation(params, loglikes) - elif issubclass(type(self._learner), keras.models.Model): + elif issubclass(type(self._learner), tensorflow.keras.models.Model): return KerasNetInterpolation(params, loglikes, model=self._learner) else: raise NotImplementedError('learner %s is not implemented.' diff --git a/pybambi/neuralnetworks/kerasnet.py b/pybambi/neuralnetworks/kerasnet.py index c6eafc9..dd4ed09 100644 --- a/pybambi/neuralnetworks/kerasnet.py +++ b/pybambi/neuralnetworks/kerasnet.py @@ -8,9 +8,9 @@ """ import numpy from pybambi.neuralnetworks.base import Predictor -from keras.models import Sequential -from keras.layers import Dense -from keras.callbacks import EarlyStopping +from tensorflow.keras.models import Sequential +from tensorflow.keras.layers import Dense +from tensorflow.keras.callbacks import EarlyStopping class KerasNetInterpolation(Predictor): diff --git a/requirements.txt b/requirements.txt index 66a81b5..9dcebf0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ tensorflow -keras numpy