mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 18:22:34 +06:00
[TF] from_pt should respect authorized_unexpected_keys (#8056)
This commit is contained in:
parent
7ff7c4934b
commit
bc9332b545
@ -208,6 +208,9 @@ def load_pytorch_weights_in_tf2_model(tf_model, pt_state_dict, tf_inputs=None, a
|
|||||||
if tf_model.authorized_missing_keys is not None:
|
if tf_model.authorized_missing_keys is not None:
|
||||||
for pat in tf_model.authorized_missing_keys:
|
for pat in tf_model.authorized_missing_keys:
|
||||||
missing_keys = [k for k in missing_keys if re.search(pat, k) is None]
|
missing_keys = [k for k in missing_keys if re.search(pat, k) is None]
|
||||||
|
if tf_model.authorized_unexpected_keys is not None:
|
||||||
|
for pat in tf_model.authorized_unexpected_keys:
|
||||||
|
unexpected_keys = [k for k in unexpected_keys if re.search(pat, k) is None]
|
||||||
|
|
||||||
if len(unexpected_keys) > 0:
|
if len(unexpected_keys) > 0:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
|
Loading…
Reference in New Issue
Block a user