From fea94d6790dcb19294ebcc629cf8191340e8ab4c Mon Sep 17 00:00:00 2001 From: Sanchit Gandhi <93869735+sanchit-gandhi@users.noreply.github.com> Date: Mon, 25 Apr 2022 21:12:51 +0200 Subject: [PATCH] Replace deprecated logger.warn with warning (#16876) --- .../research_projects/quantization-qdqbert/quant_trainer.py | 2 +- src/transformers/configuration_utils.py | 2 +- src/transformers/modeling_flax_utils.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/research_projects/quantization-qdqbert/quant_trainer.py b/examples/research_projects/quantization-qdqbert/quant_trainer.py index 9fa7978702..b9fbad8a4a 100755 --- a/examples/research_projects/quantization-qdqbert/quant_trainer.py +++ b/examples/research_projects/quantization-qdqbert/quant_trainer.py @@ -269,7 +269,7 @@ def set_quantizer(name, mod, quantizer, k, v): assert hasattr(quantizer_mod, k) setattr(quantizer_mod, k, v) else: - logger.warn(f"{name} has no {quantizer}") + logger.warning(f"{name} has no {quantizer}") def set_quantizers(name, mod, which="both", **kwargs): diff --git a/src/transformers/configuration_utils.py b/src/transformers/configuration_utils.py index 9b8b6e70fd..8e2bb961ca 100755 --- a/src/transformers/configuration_utils.py +++ b/src/transformers/configuration_utils.py @@ -306,7 +306,7 @@ class PretrainedConfig(PushToHubMixin): if self.id2label is not None: num_labels = kwargs.pop("num_labels", None) if num_labels is not None and len(self.id2label) != num_labels: - logger.warn( + logger.warning( f"You passed along `num_labels={num_labels}` with an incompatible id to label map: " f"{self.id2label}. The number of labels wil be overwritten to {self.num_labels}." ) diff --git a/src/transformers/modeling_flax_utils.py b/src/transformers/modeling_flax_utils.py index 684304b734..6b9ddfe7c1 100644 --- a/src/transformers/modeling_flax_utils.py +++ b/src/transformers/modeling_flax_utils.py @@ -641,7 +641,7 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin): unexpected_keys = set(state.keys()) - model.required_params if missing_keys and not _do_init: - logger.warn( + logger.warning( f"The checkpoint {pretrained_model_name_or_path} is missing required keys: {missing_keys}. " f"Make sure to call model.init_weights to initialize the missing weights." )