SeldonIO / alibi-detect

Algorithms for outlier, adversarial and drift detection
https://docs.seldon.io/projects/alibi-detect/en/stable/
Other
2.25k stars 225 forks source link

Got an unexpected keyword argument 'scale_identity_multiplier' #844

Closed nathan-vo810 closed 1 year ago

nathan-vo810 commented 1 year ago

Following the tutorial here https://docs.seldon.io/projects/alibi-detect/en/latest/examples/od_aegmm_kddcup.html. When trying to fit a VAEGMM Outlier Detector, the error occurs.

# initialize outlier detector
od = OutlierVAEGMM(threshold=None,
                   encoder_net=encoder_net,
                   decoder_net=decoder_net,
                   gmm_density_net=gmm_density_net,
                   n_gmm=n_gmm,
                   latent_dim=latent_dim,
                   samples=10,
                   recon_features=eucl_cosim_features)

# train
od.fit(X_train,
       epochs=50,
       batch_size=1024,
       cov_elbo=dict(sim=.0025),  # standard deviation assumption
       verbose=True)           # for elbo training

I was usingtensorflow_probability==0.20.0 and as I checked into the library, I see that the kw scale_identity_multiplier does not exist anymore.

Now, when downgrade tensorflow_probability==0.18.0 (as required in alibi-detect[tensorflow]), the following error occurs:

File "tensorflow_probability/python/internal/auto_composite_tensor.py", line 510, in type_spec_register
AttributeError: module 'tensorflow.python.framework.type_spec' has no attribute '_NAME_ TYPE_SPEC'

So, I'm not sure how to get around with this. Can someone please help?

jklaise commented 1 year ago

You're right that we've updated the code to remove scale_identity_multiplier since it no longer exists in tensorflow-probability==0.20.0, but we haven't released a patch onto PyPI, so you could install from source instead if you want to run the latest development version:

pip install git+https://github.com/SeldonIO/alibi-detect.git

Alternatively, I think the downgrade doesn't work because there's some incompatibility between the versions of tensorflow and tensorflow-probability. I would suggest trying tensorflow-probability==0.19 (see bounds here) or perhaps downgrading tensorflow by one or two minor versions.