Giter Site home page Giter Site logo

Comments (2)

daandouwe avatar daandouwe commented on May 21, 2024 1

Thanks for the clarification! This addressed all my questions.

I will give this a try!

from adapters.

arueckle avatar arueckle commented on May 21, 2024

I agree, this is a quite useful feature of AdapterFusion!

For instance, we leverage the recent_attention in our AdapterDrop paper for pruning AdapterFusion (ยง4.2). Hence, in #84, we will clean this up and add documentation on how to read out the fusion weights.

To answer your questions:

Should I understand this to be the attention displayed in the above figure? But how do I get something of shape [num_adapters, num_adapters]?

That is correct. If you consider only one downstream task you could obtain a tensor of shape [n_layers, n_adapters, seq_len]. Averaging over the last dimension gives you: [n_layers, n_adapters]. In the AdapterFusion paper, I believe we also averaged over n_layers resulting in [n_adapters]. If you now repeat this for several tasks, you get [n_tasks, n_adapters], where n_tasks ==n_adapters in the special case you are referring to.

Accessing the stored attention tensors [...] How should I do this?

One way could be:

model.roberta.encoder.layer[layer_i].output.adapter_fusion_layer['<name of the fusion layer>'].recent_attention

We will add a cleaned-up variant of this soon.

Would that address your issue?

from adapters.

Related Issues (20)

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.