alibi-detect
alibi-detect copied to clipboard
Some models fetched with fetch_tf_model are not compatible across python versions
Some of the models fetched with fetch_tf_model
are not compatible across python versions different from that the model was trained on. For example, the following code from
dataset = 'cifar10'
model = 'resnet56'
clf = fetch_tf_model(dataset, model)
results in ValueError: bad marshal data (unknown type code)
when run on examples/ad_ae_cifar10.ipynb
with python 3.8.11 and tensorflow 2.6.0 (and 2.5.x). Other models such as resnet32 in examples/cd_distillation_cifar10.ipynb
work OK.
This is likely due to marshal
being used for serialization in models with custom code (such as lambda layers), hence related to this issue: https://github.com/keras-team/keras/issues/7440.
A solution might be to use the newer tensorflow savedmodel format (https://www.tensorflow.org/guide/saved_model) for the saved models.