Comments (5)
Hi all, thanks very much for raising this and identifying the issue. I'll update the comments when I get time.
from retnet.
@Qiu30 Just had a closer look at the code (and the tests.py) and you need to note that s_n_1s is a list for MultiScaleRetention. What the comment means to say is that each element of the list has the shape (batch_size, heads, head_size, head_size). As for RetNet the state is a list of lists with each element being (batch_size, heads, head_size, head_size). So to summarize:
Retention --> Sn-1: (batch x head_dim x head_dim)
MultiscaleRetention --> Sn-1s: List of with num_head elements (tensors) each with shape (batch x head_dim x head_dim)
RetNet --> Sn-1s: List with num_layers elements. Each element is a list with elements tensors with shape (batch x head_dim x head_dim)
I hope this helps.
from retnet.
@DinoMan @Jamie-Stirling Thank you for your reply. I have the same idea as you, but I have a question, what is the initial value of s_n_1? I searched the paper and did not see the relevant initial value.
from retnet.
Hi, in the code I initialize this to zeros, however this detail is not mentioned in the paper. I'm not sure of the impact of the choice of the initial value on training, but setting to zeros ensures only the keys and values computed from the first token effect the state at t=1, akin to a transformer.
I would say, setting a nonzero constant or trainable value for the initial state is analogous to introducing a bias term, and so may affect the way the RetNet trains. Though I'm not an expert so it may be best to ask the authors of the original paper to make sure.
from retnet.
@Jamie-Stirling I understand, thanks for your reply!
from retnet.
Related Issues (20)
- RetNet Officially Released HOT 1
- Can you make this repo in available for package installers (pip)?
- demo example / number of parameter control vs original code HOT 4
- Error when the model is running on GPU HOT 1
- what about cross-attention
- Changelog of official implementation HOT 2
- can retnet be applied in point cloud tasks?
- Proposed improvement/collaboration: removing the O(T^2) training cost HOT 2
- Q, k and D device difference HOT 1
- Passing Attention Masks HOT 3
- Assistance on training a new retention network model ?
- /src/retnet.py GPU HOT 2
- The complex theta should cancel out
- How to predict use this net?
- NO LM HEAD HOT 2
- Can this mechanism be applied to PointCloud data ?
- Confusion about "the chunkwise recurrent representation of retention"
- a question about xpos and D of decay mat HOT 2
- Is Retnet equivalent to ordinary GPT when the decay is set to 1 ? HOT 3
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 retnet.