From 4c6e42958951ca66a6b498b1afce8d8ad4ac2274 Mon Sep 17 00:00:00 2001 From: Bearnardd <43574448+Bearnardd@users.noreply.github.com> Date: Wed, 21 Jun 2023 12:42:21 +0200 Subject: [PATCH] fix type annotation for debug arg (#24033) * fix type annotation for debug arg * fix TypeErorr --- src/transformers/training_args.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/transformers/training_args.py b/src/transformers/training_args.py index 71d75c6e0e..ad0df7f99d 100644 --- a/src/transformers/training_args.py +++ b/src/transformers/training_args.py @@ -873,7 +873,7 @@ class TrainingArguments: ) }, ) - debug: str = field( + debug: Union[str, List[DebugOption]] = field( default="", metadata={ "help": ( @@ -1563,8 +1563,11 @@ class TrainingArguments: ) self.debug += " tpu_metrics_debug" self.tpu_metrics_debug = False + if isinstance(self.debug, str): self.debug = [DebugOption(s) for s in self.debug.split()] + elif self.debug is None: + self.debug = [] self.deepspeed_plugin = None if self.deepspeed: