From a220c5b99f9c512ba0c4b143807a7dba621c1f0c Mon Sep 17 00:00:00 2001 From: Arthur <48595927+ArthurZucker@users.noreply.github.com> Date: Thu, 3 Oct 2024 16:34:10 +0200 Subject: [PATCH] add setter for trainer processor (#33911) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add setter for trainer processor * Update src/transformers/trainer.py Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com> --------- Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com> --- src/transformers/trainer.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/transformers/trainer.py b/src/transformers/trainer.py index c31fa8fbbdd..cc5d1ee0c36 100755 --- a/src/transformers/trainer.py +++ b/src/transformers/trainer.py @@ -742,6 +742,13 @@ class Trainer: logger.warning("Trainer.tokenizer is now deprecated. You should use Trainer.processing_class instead.") return self.processing_class + @tokenizer.setter + def tokenizer(self, processing_class) -> None: + logger.warning( + "Trainer.tokenizer is now deprecated. You should use `Trainer.processing_class = processing_class` instead." + ) + self.processing_class = processing_class + def _activate_neftune(self, model): r""" Activates the neftune as presented in this code: https://github.com/neelsjain/NEFTune and paper: