Skip to content
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

BART Support #31

Open
anshoomehra opened this issue Feb 8, 2021 · 9 comments
Open

BART Support #31

anshoomehra opened this issue Feb 8, 2021 · 9 comments

Comments

@anshoomehra
Copy link

@jalammar et al,

Can't thank you enough for your thoughtful approach with "Illustrated Transformers" & for further uncovering Transformers (visually) with the help of "Ecco". These articles not just helping folks fundamentally understand things better but are acting as a stimulator for responsible future research. So thank you for the great work!! [ I apologize for the distraction, couldn't resist my gratitude while I had this opportunity to write to you! ]

I am primarily working on BART, T5, PEGASUS base & fine-tuned variants for my research on summarization & extreme summarization objectives for my company. I understand that ecco support generative models, perhaps the support for mentioned is not there yet.

  1. Not sure, if these can be easily accommodated & your team is already in process of adding them?
  2. If not, I am sure you must be overwhelmed with similar asks, I (& am sure rest) would love to participate. I have not gone through the code yet, but if there is some jump start documentation for the code, specifically on how to refactor the code for a different type of models, perhaps we can help contribute enriching this beautiful library.
  3. While the above is looked into, would you have a suggestion of any other library which can support similar outputs for BART and Pegasus for now ??

Best,
Anshoo

@jalammar
Copy link
Owner

Hi Anshoo,

Thank you so much for your kind words!

  1. We are currently working on BERT support for activation exploration. We don't have immediate plans for supporting other models but we're listening to the community.
  2. We are working on more extensive documentation that should make it easier for people to adapt Ecco for their needs and use-cases. Thank you for the initiative.
  3. Your best bet is Captum - https://captum.ai/tutorials/Bert_SQUAD_Interpret

@anshoomehra
Copy link
Author

Hi Anshoo,

Thank you so much for your kind words!

  1. We are currently working on BERT support for activation exploration. We don't have immediate plans for supporting other models but we're listening to the community.
  2. We are working on more extensive documentation that should make it easier for people to adapt Ecco for their needs and use-cases. Thank you for the initiative.
  3. Your best bet is Captum - https://captum.ai/tutorials/Bert_SQUAD_Interpret

@jalammar Appreciate your time responding to this inquiry & the reference to Captum.

@yegorkryukov
Copy link

@jalammar Looks like 'facebook/bart-large-mnli' is now supported?

When I instantiate it I get the following error:

lm = ecco.from_pretrained('facebook/bart-large-mnli')

AttributeError                            Traceback (most recent call last)

<ipython-input-5-a9021088d96a> in <module>()
      1 import ecco
----> 2 lm = ecco.from_pretrained('facebook/bart-large-mnli')

2 frames

/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in __getattr__(self, name)
   1176                 return modules[name]
   1177         raise AttributeError("'{}' object has no attribute '{}'".format(
-> 1178             type(self).__name__, name))
   1179 
   1180     def __setattr__(self, name: str, value: Union[Tensor, 'Module']) -> None:

AttributeError: 'BartForConditionalGeneration' object has no attribute 'shared'

Any suggestions on how I can fix this?

Thanks in advance!

@jalammar
Copy link
Owner

jalammar commented Jan 9, 2022

Unfortunately BART support wasn't completely there yet. I just made a couple of updates, could you try it now?

Install the latest version of the repo:
!pip install git+https://github.com/jalammar/ecco.git

@yegorkryukov
Copy link

Thank you Jay. The model now loads.

I'm trying to understand how to use it with the MNLI model. That model accepts a premise and a label. Where the premise is a piece of text ('Computer shut down unexpectedly') and a label ('politics'). So, the model spits out its prediction whether the label is correct for the premise.

I can't figure out how to pass those two elements (premise and label) to any functions in the ecco lm. Any advice?

@jalammar
Copy link
Owner

My guess would be that that they put them in the same string separated by the [sep] token. The paper or model docs should explain that, I think.

@Lim-Sung-Jun
Copy link

Hello, @jalammar

Is there example of using a BERT?
I've seen a lot examples of GPT..

I want to use saliency on BERT's head, not INPUT TOKEN.

@jalammar
Copy link
Owner

@Lim-Sung-Jun There are examples of using BERT for neuron activation, but not for primary feature attribution/saliency. That hasn't been built out yet. I have create issue #64 to track the feature request and invite people to support it.

@Lim-Sung-Jun
Copy link

@Lim-Sung-Jun There are examples of using BERT for neuron activation, but not for primary feature attribution/saliency. That hasn't been built out yet. I have create issue #64 to track the feature request and invite people to support it.

I really appreciate your support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants