Giter VIP home page Giter VIP logo

Comments (4)

ChinaYi avatar ChinaYi commented on September 7, 2024

Sorry for my late response. You can save the attention weights during testing

from asformer.

emanuele-mincato avatar emanuele-mincato commented on September 7, 2024

ok, thanks for the reply.
Just to be sure the attention weight are the 'attention' matrix of the following line of code, right?
output, attention = self.att_helper.scalar_dot_att(q, k, v, final_mask)

In my case I extracted them from the '_sliding_window_self_att(self, q, k, v, mask)' function.
Thanks

from asformer.

emanuele-mincato avatar emanuele-mincato commented on September 7, 2024

I am asking because I find that most of the time if an encoder find a strong attention to some frames inside his windows, the enoder of the next block will give 0 (red cross) attention for the same frames. As you can see from the image below. So maybe I am extract the attention weight in the wrong way. This is the code I use to extract them:
att_weight = attention.reshape([attention.shape[0] * attention.shape[2], attention.shape[1]])
save_dir_att = 'attention_weight'
torch.save(att_weight, save_dir_att + '/att_weigth_window_size_' + str("%03d" % (b.shape[1],)) + '.t')
the code is inside the '_sliding_window_self_att(self, q, k, v, mask)' function
download

from asformer.

emanuele-mincato avatar emanuele-mincato commented on September 7, 2024

Sorry to bother you again, but there is a reason behind it or is it just that I am extracting the attention weights in the wrong way? Thanks for your time

from asformer.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.