Comments (5)
@yyht A few questions:
- Did you initialize \alpha to zero?
- How did you initialize the embedding matrix? We found that GPT2's embedding initialization doesn't work very well.
from rezero.
- I initizlied \alpha to zero
- the initialization are followed by official BERT initialization:
ebmbedding matrix and kernel matrix are initialized via:
def create_initializer(initializer_range=0.02):
"""Creates atruncated_normal_initializer
with the given range."""
return tf.truncated_normal_initializer(stddev=initializer_range)
from rezero.
Try initializing the embedding matrix to uniform distribution drawn from +- 1 / d
.
from rezero.
@calclavia can you give a little more insight into reasoning for this embedding init recommendation? Curious if it's motivated by empirical performance or other theoretical justification.
from rezero.
@sooheon It depends on the particular implementation of your Transformer. Some implementations (Huggingface) scale the embedding by 1 / d before padding it into higher layers while initializing the embedding with a uniform distribution (-1 to + 1). This effectively does the same thing as initializing it as +- 1/d.
The reasoning for this initialization is less to do with our paper - we simply follow what previous work has recommended. I believe the Attention is all your need paper recommended 1/d scaling for attentional softmax (when d is large). By scaling to 1/d, the gradients for the softmax layer is more well behaved.
The same principle is applied to the output softmax when predicting output vocabularies. When Rezero initializes the Transformer layers to zero, it essentially starts off as a pass-through from input embedding directly to output embedding. Having 1/d initialization ensures the gradients as well behaved.
from rezero.
Related Issues (16)
- Can the method be applied to CNN? HOT 1
- can rezero be applied to cnn ? HOT 1
- Sry guys but your paper is not worth more than zero :) HOT 1
- The description of RZTXDecoderLayer is the same as EncoderLayer
- Can you relaese the code for ResNet-56 in Table2 ?
- weight decay for the resweight? HOT 2
- Is ReZero applicable to fine-tuning?
- resweight is almost 0 HOT 1
- Learning rate of the Param resweight
- I don't see any other application other than NLP? HOT 1
- rezero with norm HOT 1
- does rezero work in machine translation tasks? HOT 3
- Relationship between ReZero and Zero gamma trick HOT 2
- Does it work in not so deep architectures? HOT 3
- The order of dropout and *resweight 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 rezero.