Comments (6)
@lucidrains thanks for your quick reply. I double check the code and understand that the causal_mask
will be created when causal==True
and everything is well taken care of.
However, I'm curious about these parts below.
FLASH-pytorch/flash_pytorch/flash_pytorch.py
Lines 317 to 319 in 473ab62
FLASH-pytorch/flash_pytorch/flash_pytorch.py
Lines 352 to 353 in 473ab62
In summary, my two question is:
By default, mask=None
, what is this variable for and what is the difference between mask
and causal_mask
?
from flash-pytorch.
@keyunluo oops! should be fixed here 8e0d2fd
from flash-pytorch.
In vanilla multi-head transformer, the mask is an upper triangle matrix and the shape of mask is [bs, n_head, seq, seq]. But here, the shape of mask is [bs, seq]. Is any explanation for this? How do we set the mask for mixed chunk attention, performing similarly to the upper triangle matrix?
from flash-pytorch.
@marsggbo just set causal = True
and everything is taken care of
from flash-pytorch.
@marsggbo the mask is for non-causal variable lengthed sequences
from flash-pytorch.
mask is for bidirectional attention (like BERT)
you often have sequences of variable lengths, so you would use the mask to only attend to non-padding tokens
from flash-pytorch.
Related Issues (12)
- Is it a typo in FLASH module? HOT 1
- The speed.
- AttributeError: module 'torch' has no attribute 'special' HOT 2
- About the "/n"
- einsum operation in Linear Attention Part HOT 5
- Cross-Attention? HOT 2
- About the "shift_tokens" HOT 2
- Speed on TPU HOT 1
- Laplace Activation Function Implementation HOT 1
- About negative values in my input sentence embeddings
- rel_pos_bias in GAU HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flash-pytorch.