-
Notifications
You must be signed in to change notification settings - Fork 106
Set init_method_std default to sqrt(0.3333/hidden_size) #1337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -631,9 +631,10 @@ class TransformerConfig(ModelParallelConfig): | |
| will be set to paddlefleet.utils.scaled_init_method_normal(init_method_std) which is paddle nn | ||
| init normal with mean=0.0 and std=init_method_std / math.sqrt(2.0 * num_hidden_layers).""" | ||
|
|
||
| init_method_std: float = 0.02 | ||
| init_method_std: float = None | ||
| """Standard deviation of the zero mean normal for the default initialization method, not used if | ||
| init_method and output_layer_init_method are provided.""" | ||
| init_method and output_layer_init_method are provided. If None, will be set to | ||
| math.sqrt(0.3333 / hidden_size).""" | ||
|
|
||
| embedding_init_method: callable = None | ||
| """ | ||
|
|
@@ -984,6 +985,12 @@ def __post_init__(self): | |
| details. | ||
| """ | ||
| super().__post_init__() | ||
|
|
||
| if self.init_method_std is None: | ||
| if self.hidden_size == 0: | ||
| self.init_method_std = 0.02 | ||
| else: | ||
| self.init_method_std = math.sqrt(0.3333 / self.hidden_size) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里把未显式传入的 如果这是预期的新默认行为,请在同一个 PR 中同步更新 expected_sigma = math.sqrt(0.3333 / 768)
self.assertAlmostEqual(config.init_method_std, expected_sigma, places=6) |
||
| if self.enable_mtp_magic_send: | ||
| assert self.num_nextn_predict_layers == 1, ( | ||
| "enable_mtp_magic_send only supports num_nextn_predict_layers=1" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.