mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-02 03:01:07 +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_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
|
||||||
|
Loading…
Reference in New Issue
Block a user