Quantus icon indicating copy to clipboard operation
Quantus copied to clipboard

Missing module in 'quantus.helpers.utils'

Open PouyaKhn opened this issue 1 year ago • 2 comments

A error just popped up which is required for torch models when I want to evaluate XAI methods:

AttributeError Traceback (most recent call last) in <cell line: 8>() 6 7 # Call the metric instance to produce scores. ----> 8 results = {method: selectivity(model=model, 9 x_batch=x_batch, 10 y_batch=y_batch,

/usr/local/lib/python3.9/dist-packages/quantus/helpers/model/pytorch_model.py in shape_input(self, x, shape, channel_first, batched) 125 # Set channel order according to expected input of model. 126 if self.channel_first: --> 127 return utils.make_channel_first(x, channel_first) 128 raise ValueError("Channel first order expected for a torch model.") 129

AttributeError: module 'quantus.helpers.utils' has no attribute 'make_channel_first'

I also checked utils module, but this module already has 'make_channel_first' function. IDK why this error happens?

Can anyone propose a solution?

PouyaKhn avatar Mar 30 '23 19:03 PouyaKhn

Hi, thank you for letting us know about this!

Can you give some more context around this call? Is it from a notebook, in that case, which one?

The function make_channel_first do exist in quantus.helpers.utils.

Thanks!

annahedstroem avatar Apr 05 '23 19:04 annahedstroem

I meet the same issue in https://github.com/understandable-machine-intelligence-lab/Quantus/blob/main/tutorials/Tutorial_ImageNet_Example_All_Metrics.ipynb when use ROAD

xingzhongyu avatar Jul 07 '23 09:07 xingzhongyu