hila-chefer / Transformer-Explainability

[CVPR 2021] Official PyTorch implementation for Transformer Interpretability Beyond Attention Visualization, a novel method to visualize classifications by Transformer based networks.
MIT License
1.75k stars 232 forks source link

using finetuned ViT weights/model from the Torchvision library #49

Closed PedroDKE closed 1 year ago

PedroDKE commented 1 year ago

Hey, first of thanks for all the work in this repo!

I'm trying to adjust the sample notebook to work with ViT from the torchvision library, As you might think already, im getting the "AttributeError: 'VisionTransformer' object has no attribute 'relprop' " error. As suggested in #30 i should pass/load the weights to the modified implementation of this repo. I can not figure out how i'm supposed to do this? more specifically: when calling vit_LRP(pretrained=True) how should i pass my own weights/ Torchvision model to be used?

hila-chefer commented 1 year ago

Hi @PedroDKE, thanks for your interest in our work!

As mentioned in this answer you can load your own weights as long as they are compatible with the implementation from timm.

does this help?

PedroDKE commented 1 year ago

Will have a look, thank you! :)

hila-chefer commented 1 year ago

Closing this issue for now, please reopen if necessary.