mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 10:12:23 +06:00
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: Julien Chaumond <chaumond@gmail.com> Co-authored-by: Julien Chaumond <chaumond@gmail.com>
This commit is contained in:
parent
b9109f2de1
commit
79ab881eb1
@ -163,6 +163,10 @@ class XLNetConfig(PretrainedConfig):
|
||||
self.n_layer = n_layer
|
||||
self.n_head = n_head
|
||||
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.ff_activation = ff_activation
|
||||
self.d_inner = d_inner
|
||||
|
Loading…
Reference in New Issue
Block a user