Silence warning in gradient checkpointing when it's False (#13734)

This commit is contained in:
Sylvain Gugger 2021-09-27 07:43:38 -04:00 committed by GitHub
parent 3ffd18a617
commit e00bc7cd2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -332,7 +332,7 @@ class PretrainedConfig(PushToHubMixin):
self.transformers_version = kwargs.pop("transformers_version", None)
# Deal with gradient checkpointing
if "gradient_checkpointing" in kwargs:
if kwargs.get("gradient_checkpointing", True):
warnings.warn(
"Passing `gradient_checkpointing` to a config initialization is deprecated and will be removed in v5 "
"Transformers. Using `model.gradient_checkpointing_enable()` instead, or if you are using the "