opennlplab / cosformer Goto Github PK
View Code? Open in Web Editor NEW[ICLR 2022] Official implementation of cosformer-attention in cosFormer: Rethinking Softmax in Attention
License: Apache License 2.0
[ICLR 2022] Official implementation of cosformer-attention in cosFormer: Rethinking Softmax in Attention
License: Apache License 2.0
In the paper,it mentioned that the work of the bidirectional language modeling pre-train has been done. Are you planning on releasing some pre-trained weights for the model?
this is more general(from my perspective)
q,k,v shape : (b,s,d)
q = q.contiguous()
q = rearrange(q, 'b n (h d) -> (b h) n d', h = self.num_heads)
k = k.contiguous()
k = rearrange(k, 'b n (h d) -> (b h) n d', h = self.num_heads)
v = v.contiguous()
v = rearrange(v, 'b n (h d) -> (b h) n d', h = self.num_heads)
Thanks for the awesome project.
I wonder when the code will be released. Thank you ;)
Thanks very much for your interesting work! I have a question about the O(N) space complexity mentioned in your paper. I am wondering whether you can help me to figure it out.
In Eq. (11) of your paper, you compute QK^T in the denominator, which may lead to O(N^2*d) space complexity?
bests
Compared with left_product
function, attention mask is not used in forward()
function.
How to use the attention mask in the forward method?
When implementing cosformer on MultiHeadAttention in Transformer-XL and running without extra long-range memory, the ReLU performance is worse than eLU. I think it is because the Attention and FF Net are different since XL-like transformer has different layer norm and residual connection. Why this ReLU(Q)ReLU(K).T softmax replacement is not robust on different transformer architectures?
Hello!
In the Figure 1, how do you get memory consumption of cosFormer on the LRA benchmark? Could you please open source script for computing it?
diff += torch.norm(left_res - right_res)
What does diff stand for
We are examining non-NLP applications of the cosformer self-attention, and would need to use attention masking for the padded tokens in the batch.
Is there a way to incorporate this ?
Because the code does not explicitly compute the attention weights on which masking is traditionally applied.
Thank you for your great work! I am currently working on a seq2seq task and I found the causal attention code only works the src_len and the tgt_len are the same. Also, I suggest that you could adopt EPFL's causal linear attention CUDA code to improve the speed of causal attention.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.