Unverified Commit 79ab881e authored by Lysandre Debut's avatar Lysandre Debut Committed by GitHub
Browse files

No silent error when d_head already in the configuration (#4747)



* No silent error when d_head already in the configuration

* Update src/transformers/configuration_xlnet.py
Co-authored-by: default avatarJulien Chaumond <chaumond@gmail.com>
Co-authored-by: default avatarJulien Chaumond <chaumond@gmail.com>
parent b9109f2d
...@@ -163,6 +163,10 @@ class XLNetConfig(PretrainedConfig): ...@@ -163,6 +163,10 @@ class XLNetConfig(PretrainedConfig):
self.n_layer = n_layer self.n_layer = n_layer
self.n_head = n_head self.n_head = n_head
assert d_model % n_head == 0 assert d_model % n_head == 0
if "d_head" in kwargs:
assert kwargs["d_head"] == d_model // n_head, (
f"`d_head` ({kwargs['d_head']}) should be equal to `d_model // n_head` ({d_model // n_head})"
)
self.d_head = d_model // n_head self.d_head = d_model // n_head
self.ff_activation = ff_activation self.ff_activation = ff_activation
self.d_inner = d_inner self.d_inner = d_inner
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment