diff --git a/examples/flax/image-captioning/create_model_from_encoder_decoder_models.py b/examples/flax/image-captioning/create_model_from_encoder_decoder_models.py index c5ce0e4ce13..0ebd1464883 100644 --- a/examples/flax/image-captioning/create_model_from_encoder_decoder_models.py +++ b/examples/flax/image-captioning/create_model_from_encoder_decoder_models.py @@ -37,7 +37,7 @@ class ModelArguments: encoder_model_name_or_path: str = field( metadata={ "help": ( - "The encoder model checkpoint for weights initialization." + "The encoder model checkpoint for weights initialization. " "Don't set if you want to train an encoder model from scratch." ) }, @@ -45,7 +45,7 @@ class ModelArguments: decoder_model_name_or_path: str = field( metadata={ "help": ( - "The decoder model checkpoint for weights initialization." + "The decoder model checkpoint for weights initialization. " "Don't set if you want to train a decoder model from scratch." ) }, diff --git a/examples/flax/image-captioning/run_image_captioning_flax.py b/examples/flax/image-captioning/run_image_captioning_flax.py index d8c89c1a242..8ed330946d7 100644 --- a/examples/flax/image-captioning/run_image_captioning_flax.py +++ b/examples/flax/image-captioning/run_image_captioning_flax.py @@ -203,7 +203,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -256,7 +256,7 @@ class DataTrainingArguments: metadata={ "help": ( "The maximum total sequence length for validation target text after tokenization. Sequences longer " - "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`." + "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`. " "This argument is also used to override the `max_length` param of `model.generate`, which is used " "during evaluation." ) @@ -423,7 +423,7 @@ def main(): and not training_args.overwrite_output_dir ): raise ValueError( - f"Output directory ({training_args.output_dir}) already exists and is not empty." + f"Output directory ({training_args.output_dir}) already exists and is not empty. " "Use --overwrite_output_dir to overcome." ) @@ -685,7 +685,7 @@ def main(): eval_batch_size = int(training_args.per_device_eval_batch_size) * jax.device_count() if training_args.block_size % train_batch_size > 0 or training_args.block_size % eval_batch_size > 0: raise ValueError( - "`training_args.block_size` needs to be a multiple of the global train/eval batch size." + "`training_args.block_size` needs to be a multiple of the global train/eval batch size. " f"Got {training_args.block_size}, {train_batch_size} and {eval_batch_size} respectively instead." ) diff --git a/examples/flax/language-modeling/run_bart_dlm_flax.py b/examples/flax/language-modeling/run_bart_dlm_flax.py index d1928dd7313..b3e2ac0453b 100644 --- a/examples/flax/language-modeling/run_bart_dlm_flax.py +++ b/examples/flax/language-modeling/run_bart_dlm_flax.py @@ -487,7 +487,7 @@ def main(): and not training_args.overwrite_output_dir ): raise ValueError( - f"Output directory ({training_args.output_dir}) already exists and is not empty." + f"Output directory ({training_args.output_dir}) already exists and is not empty. " "Use --overwrite_output_dir to overcome." ) @@ -606,7 +606,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/flax/language-modeling/run_clm_flax.py b/examples/flax/language-modeling/run_clm_flax.py index c61b24f4d7e..93990db327b 100755 --- a/examples/flax/language-modeling/run_clm_flax.py +++ b/examples/flax/language-modeling/run_clm_flax.py @@ -190,7 +190,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -368,7 +368,7 @@ def main(): and not training_args.overwrite_output_dir ): raise ValueError( - f"Output directory ({training_args.output_dir}) already exists and is not empty." + f"Output directory ({training_args.output_dir}) already exists and is not empty. " "Use --overwrite_output_dir to overcome." ) @@ -524,7 +524,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) @@ -586,7 +586,7 @@ def main(): else: if data_args.block_size > tokenizer.model_max_length: logger.warning( - f"The block_size passed ({data_args.block_size}) is larger than the maximum length for the model" + f"The block_size passed ({data_args.block_size}) is larger than the maximum length for the model " f"({tokenizer.model_max_length}). Using block_size={tokenizer.model_max_length}." ) block_size = min(data_args.block_size, tokenizer.model_max_length) diff --git a/examples/flax/language-modeling/run_mlm_flax.py b/examples/flax/language-modeling/run_mlm_flax.py index 00c1bb32d09..6a062781a92 100755 --- a/examples/flax/language-modeling/run_mlm_flax.py +++ b/examples/flax/language-modeling/run_mlm_flax.py @@ -195,7 +195,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -411,7 +411,7 @@ def main(): and not training_args.overwrite_output_dir ): raise ValueError( - f"Output directory ({training_args.output_dir}) already exists and is not empty." + f"Output directory ({training_args.output_dir}) already exists and is not empty. " "Use --overwrite_output_dir to overcome." ) @@ -556,7 +556,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/flax/language-modeling/run_t5_mlm_flax.py b/examples/flax/language-modeling/run_t5_mlm_flax.py index a4641dc2152..70566132c01 100755 --- a/examples/flax/language-modeling/run_t5_mlm_flax.py +++ b/examples/flax/language-modeling/run_t5_mlm_flax.py @@ -528,7 +528,7 @@ def main(): and not training_args.overwrite_output_dir ): raise ValueError( - f"Output directory ({training_args.output_dir}) already exists and is not empty." + f"Output directory ({training_args.output_dir}) already exists and is not empty. " "Use --overwrite_output_dir to overcome." ) @@ -647,7 +647,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/flax/question-answering/run_qa.py b/examples/flax/question-answering/run_qa.py index 0d35f302f8f..8ca0ab54222 100644 --- a/examples/flax/question-answering/run_qa.py +++ b/examples/flax/question-answering/run_qa.py @@ -176,7 +176,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -582,7 +582,7 @@ def main(): if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/flax/speech-recognition/run_flax_speech_recognition_seq2seq.py b/examples/flax/speech-recognition/run_flax_speech_recognition_seq2seq.py index 8af835b6a4b..cdfeff42f81 100644 --- a/examples/flax/speech-recognition/run_flax_speech_recognition_seq2seq.py +++ b/examples/flax/speech-recognition/run_flax_speech_recognition_seq2seq.py @@ -415,7 +415,7 @@ def main(): and not training_args.overwrite_output_dir ): raise ValueError( - f"Output directory ({training_args.output_dir}) already exists and is not empty." + f"Output directory ({training_args.output_dir}) already exists and is not empty. " "Use `--overwrite_output_dir` to overcome." ) diff --git a/examples/flax/summarization/run_summarization_flax.py b/examples/flax/summarization/run_summarization_flax.py index 782e9ee88c4..f389106c481 100644 --- a/examples/flax/summarization/run_summarization_flax.py +++ b/examples/flax/summarization/run_summarization_flax.py @@ -209,7 +209,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -268,7 +268,7 @@ class DataTrainingArguments: metadata={ "help": ( "The maximum total sequence length for validation target text after tokenization. Sequences longer " - "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`." + "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`. " "This argument is also used to override the `max_length` param of `model.generate`, which is used " "during evaluation." ) @@ -451,7 +451,7 @@ def main(): and not training_args.overwrite_output_dir ): raise ValueError( - f"Output directory ({training_args.output_dir}) already exists and is not empty." + f"Output directory ({training_args.output_dir}) already exists and is not empty. " "Use --overwrite_output_dir to overcome." ) @@ -558,7 +558,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/flax/text-classification/run_flax_glue.py b/examples/flax/text-classification/run_flax_glue.py index 1535ff84927..f1a4b79a600 100755 --- a/examples/flax/text-classification/run_flax_glue.py +++ b/examples/flax/text-classification/run_flax_glue.py @@ -122,7 +122,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, diff --git a/examples/flax/token-classification/run_flax_ner.py b/examples/flax/token-classification/run_flax_ner.py index e06a85cb67c..f01a17457ae 100644 --- a/examples/flax/token-classification/run_flax_ner.py +++ b/examples/flax/token-classification/run_flax_ner.py @@ -170,7 +170,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, diff --git a/examples/flax/vision/run_image_classification.py b/examples/flax/vision/run_image_classification.py index 4bed9b663f6..c56a28246ec 100644 --- a/examples/flax/vision/run_image_classification.py +++ b/examples/flax/vision/run_image_classification.py @@ -180,7 +180,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -291,7 +291,7 @@ def main(): and not training_args.overwrite_output_dir ): raise ValueError( - f"Output directory ({training_args.output_dir}) already exists and is not empty." + f"Output directory ({training_args.output_dir}) already exists and is not empty. " "Use --overwrite_output_dir to overcome." ) diff --git a/examples/legacy/multiple_choice/utils_multiple_choice.py b/examples/legacy/multiple_choice/utils_multiple_choice.py index 9ffaa7971b5..e3bbc72884f 100644 --- a/examples/legacy/multiple_choice/utils_multiple_choice.py +++ b/examples/legacy/multiple_choice/utils_multiple_choice.py @@ -379,7 +379,7 @@ class SwagProcessor(DataProcessor): """See base class.""" logger.info("LOOKING AT {} dev".format(data_dir)) raise ValueError( - "For swag testing, the input file does not contain a label column. It can not be tested in current code" + "For swag testing, the input file does not contain a label column. It can not be tested in current code " "setting!" ) return self._create_examples(self._read_csv(os.path.join(data_dir, "test.csv")), "test") @@ -541,7 +541,7 @@ def convert_examples_to_features( if "num_truncated_tokens" in inputs and inputs["num_truncated_tokens"] > 0: logger.info( "Attention! you are cropping tokens (swag task is ok). " - "If you are training ARC and RACE and you are poping question + options," + "If you are training ARC and RACE and you are poping question + options, " "you need to try to use a bigger max seq length!" ) diff --git a/examples/legacy/pytorch-lightning/lightning_base.py b/examples/legacy/pytorch-lightning/lightning_base.py index f246ecab0dd..640828bacd3 100644 --- a/examples/legacy/pytorch-lightning/lightning_base.py +++ b/examples/legacy/pytorch-lightning/lightning_base.py @@ -313,7 +313,7 @@ def add_generic_args(parser, root_dir) -> None: type=str, default="O2", help=( - "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']." + "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. " "See details at https://nvidia.github.io/apex/amp.html" ), ) diff --git a/examples/legacy/question-answering/run_squad.py b/examples/legacy/question-answering/run_squad.py index fc9411e95d2..b8e8b58813b 100644 --- a/examples/legacy/question-answering/run_squad.py +++ b/examples/legacy/question-answering/run_squad.py @@ -663,7 +663,7 @@ def main(): type=str, default="O1", help=( - "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']." + "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. " "See details at https://nvidia.github.io/apex/amp.html" ), ) diff --git a/examples/legacy/run_language_modeling.py b/examples/legacy/run_language_modeling.py index 59490f710e1..b1576586562 100755 --- a/examples/legacy/run_language_modeling.py +++ b/examples/legacy/run_language_modeling.py @@ -149,7 +149,7 @@ class DataTrainingArguments: default=-1, metadata={ "help": ( - "Optional input sequence length after tokenization." + "Optional input sequence length after tokenization. " "The training dataset will be truncated in block of this size for training." "Default to the model max input length for single sentence inputs (take into account special tokens)." ) @@ -283,7 +283,7 @@ def main(): if config.model_type in ["bert", "roberta", "distilbert", "camembert"] and not data_args.mlm: raise ValueError( - "BERT and RoBERTa-like models do not have LM heads but masked LM heads. They must be run using the" + "BERT and RoBERTa-like models do not have LM heads but masked LM heads. They must be run using the " "--mlm flag (masked language modeling)." ) diff --git a/examples/legacy/run_swag.py b/examples/legacy/run_swag.py index bde05016875..a8d72c2c694 100755 --- a/examples/legacy/run_swag.py +++ b/examples/legacy/run_swag.py @@ -579,7 +579,7 @@ def main(): type=str, default="O1", help=( - "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']." + "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. " "See details at https://nvidia.github.io/apex/amp.html" ), ) diff --git a/examples/pytorch/audio-classification/run_audio_classification.py b/examples/pytorch/audio-classification/run_audio_classification.py index 64d532ff42e..a157b643e42 100644 --- a/examples/pytorch/audio-classification/run_audio_classification.py +++ b/examples/pytorch/audio-classification/run_audio_classification.py @@ -172,7 +172,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -189,14 +189,14 @@ class ModelArguments: if not self.freeze_feature_extractor and self.freeze_feature_encoder: warnings.warn( "The argument `--freeze_feature_extractor` is deprecated and " - "will be removed in a future version. Use `--freeze_feature_encoder`" + "will be removed in a future version. Use `--freeze_feature_encoder` " "instead. Setting `freeze_feature_encoder==True`.", FutureWarning, ) if self.freeze_feature_extractor and not self.freeze_feature_encoder: raise ValueError( "The argument `--freeze_feature_extractor` is deprecated and " - "should not be used in combination with `--freeze_feature_encoder`." + "should not be used in combination with `--freeze_feature_encoder`. " "Only make use of `--freeze_feature_encoder`." ) diff --git a/examples/pytorch/contrastive-image-text/run_clip.py b/examples/pytorch/contrastive-image-text/run_clip.py index d8eb77ace15..dbb22900115 100644 --- a/examples/pytorch/contrastive-image-text/run_clip.py +++ b/examples/pytorch/contrastive-image-text/run_clip.py @@ -107,7 +107,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -358,7 +358,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/pytorch/image-classification/run_image_classification.py b/examples/pytorch/image-classification/run_image_classification.py index 0f8a2d723cc..27a81f00948 100644 --- a/examples/pytorch/image-classification/run_image_classification.py +++ b/examples/pytorch/image-classification/run_image_classification.py @@ -163,7 +163,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, diff --git a/examples/pytorch/image-classification/run_image_classification_no_trainer.py b/examples/pytorch/image-classification/run_image_classification_no_trainer.py index 6190cd5be22..3e38a3e79a7 100644 --- a/examples/pytorch/image-classification/run_image_classification_no_trainer.py +++ b/examples/pytorch/image-classification/run_image_classification_no_trainer.py @@ -152,7 +152,7 @@ def parse_args(): default=False, help=( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ), ) @@ -179,7 +179,7 @@ def parse_args(): default="all", help=( 'The integration to report the results and logs to. Supported platforms are `"tensorboard"`,' - ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations.' + ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations. ' "Only applicable when `--with_tracking` is passed." ), ) diff --git a/examples/pytorch/image-pretraining/run_mim.py b/examples/pytorch/image-pretraining/run_mim.py index 54334fc154d..1ab932f7f09 100644 --- a/examples/pytorch/image-pretraining/run_mim.py +++ b/examples/pytorch/image-pretraining/run_mim.py @@ -174,7 +174,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, diff --git a/examples/pytorch/image-pretraining/run_mim_no_trainer.py b/examples/pytorch/image-pretraining/run_mim_no_trainer.py index 4dba286cc97..74b4e99f260 100644 --- a/examples/pytorch/image-pretraining/run_mim_no_trainer.py +++ b/examples/pytorch/image-pretraining/run_mim_no_trainer.py @@ -208,7 +208,7 @@ def parse_args(): default=False, help=( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ), ) @@ -246,7 +246,7 @@ def parse_args(): default="all", help=( 'The integration to report the results and logs to. Supported platforms are `"tensorboard"`,' - ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations.' + ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations. ' "Only applicable when `--with_tracking` is passed." ), ) diff --git a/examples/pytorch/language-modeling/run_clm.py b/examples/pytorch/language-modeling/run_clm.py index 15c9261be48..4d8e885a576 100755 --- a/examples/pytorch/language-modeling/run_clm.py +++ b/examples/pytorch/language-modeling/run_clm.py @@ -132,7 +132,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -151,7 +151,7 @@ class ModelArguments: default=False, metadata={ "help": ( - "It is an option to create the model as an empty shell, then only materialize its parameters when the pretrained weights are loaded." + "It is an option to create the model as an empty shell, then only materialize its parameters when the pretrained weights are loaded. " "set True will benefit LLM loading time and RAM consumption." ) }, @@ -424,7 +424,7 @@ def main(): tokenizer = AutoTokenizer.from_pretrained(model_args.model_name_or_path, **tokenizer_kwargs) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) @@ -506,7 +506,7 @@ def main(): else: if data_args.block_size > tokenizer.model_max_length: logger.warning( - f"The block_size passed ({data_args.block_size}) is larger than the maximum length for the model" + f"The block_size passed ({data_args.block_size}) is larger than the maximum length for the model " f"({tokenizer.model_max_length}). Using block_size={tokenizer.model_max_length}." ) block_size = min(data_args.block_size, tokenizer.model_max_length) diff --git a/examples/pytorch/language-modeling/run_clm_no_trainer.py b/examples/pytorch/language-modeling/run_clm_no_trainer.py index 75f993b2c48..292b2e8db19 100755 --- a/examples/pytorch/language-modeling/run_clm_no_trainer.py +++ b/examples/pytorch/language-modeling/run_clm_no_trainer.py @@ -199,7 +199,7 @@ def parse_args(): default=False, help=( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ), ) @@ -226,7 +226,7 @@ def parse_args(): default="all", help=( 'The integration to report the results and logs to. Supported platforms are `"tensorboard"`,' - ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations.' + ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations. ' "Only applicable when `--with_tracking` is passed." ), ) @@ -234,7 +234,7 @@ def parse_args(): "--low_cpu_mem_usage", action="store_true", help=( - "It is an option to create the model as an empty shell, then only materialize its parameters when the pretrained weights are loaded." + "It is an option to create the model as an empty shell, then only materialize its parameters when the pretrained weights are loaded. " "If passed, LLM loading time and RAM consumption will be benefited." ), ) @@ -398,7 +398,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) @@ -449,7 +449,7 @@ def main(): else: if args.block_size > tokenizer.model_max_length: logger.warning( - f"The block_size passed ({args.block_size}) is larger than the maximum length for the model" + f"The block_size passed ({args.block_size}) is larger than the maximum length for the model " f"({tokenizer.model_max_length}). Using block_size={tokenizer.model_max_length}." ) block_size = min(args.block_size, tokenizer.model_max_length) diff --git a/examples/pytorch/language-modeling/run_mlm.py b/examples/pytorch/language-modeling/run_mlm.py index 0d6525cef52..007cad43544 100755 --- a/examples/pytorch/language-modeling/run_mlm.py +++ b/examples/pytorch/language-modeling/run_mlm.py @@ -128,7 +128,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -137,7 +137,7 @@ class ModelArguments: default=False, metadata={ "help": ( - "It is an option to create the model as an empty shell, then only materialize its parameters when the pretrained weights are loaded." + "It is an option to create the model as an empty shell, then only materialize its parameters when the pretrained weights are loaded. " "set True will benefit LLM loading time and RAM consumption." ) }, @@ -417,7 +417,7 @@ def main(): tokenizer = AutoTokenizer.from_pretrained(model_args.model_name_or_path, **tokenizer_kwargs) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) @@ -462,7 +462,7 @@ def main(): else: if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/pytorch/language-modeling/run_mlm_no_trainer.py b/examples/pytorch/language-modeling/run_mlm_no_trainer.py index 1330aeb683f..e87c3859e31 100755 --- a/examples/pytorch/language-modeling/run_mlm_no_trainer.py +++ b/examples/pytorch/language-modeling/run_mlm_no_trainer.py @@ -206,7 +206,7 @@ def parse_args(): default=False, help=( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ), ) @@ -233,7 +233,7 @@ def parse_args(): default="all", help=( 'The integration to report the results and logs to. Supported platforms are `"tensorboard"`,' - ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations.' + ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations. ' "Only applicable when `--with_tracking` is passed." ), ) @@ -241,7 +241,7 @@ def parse_args(): "--low_cpu_mem_usage", action="store_true", help=( - "It is an option to create the model as an empty shell, then only materialize its parameters when the pretrained weights are loaded." + "It is an option to create the model as an empty shell, then only materialize its parameters when the pretrained weights are loaded. " "If passed, LLM loading time and RAM consumption will be benefited." ), ) @@ -395,7 +395,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) @@ -434,7 +434,7 @@ def main(): else: if args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/pytorch/language-modeling/run_plm.py b/examples/pytorch/language-modeling/run_plm.py index 1063ca7ac90..79d043e3cba 100755 --- a/examples/pytorch/language-modeling/run_plm.py +++ b/examples/pytorch/language-modeling/run_plm.py @@ -115,7 +115,7 @@ class ModelArguments: default=False, metadata={ "help": ( - "It is an option to create the model as an empty shell, then only materialize its parameters when the pretrained weights are loaded." + "It is an option to create the model as an empty shell, then only materialize its parameters when the pretrained weights are loaded. " "set True will benefit LLM loading time and RAM consumption." ) }, @@ -385,7 +385,7 @@ def main(): tokenizer = AutoTokenizer.from_pretrained(model_args.model_name_or_path, **tokenizer_kwargs) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) @@ -419,7 +419,7 @@ def main(): if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/pytorch/multiple-choice/run_swag.py b/examples/pytorch/multiple-choice/run_swag.py index c1b69a51bb1..88f10423a57 100755 --- a/examples/pytorch/multiple-choice/run_swag.py +++ b/examples/pytorch/multiple-choice/run_swag.py @@ -100,7 +100,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -375,7 +375,7 @@ def main(): else: if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/pytorch/multiple-choice/run_swag_no_trainer.py b/examples/pytorch/multiple-choice/run_swag_no_trainer.py index 27239937ae9..02544bc41c6 100755 --- a/examples/pytorch/multiple-choice/run_swag_no_trainer.py +++ b/examples/pytorch/multiple-choice/run_swag_no_trainer.py @@ -188,7 +188,7 @@ def parse_args(): default=False, help=( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ), ) @@ -215,7 +215,7 @@ def parse_args(): default="all", help=( 'The integration to report the results and logs to. Supported platforms are `"tensorboard"`,' - ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations.' + ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations. ' "Only applicable when `--with_tracking` is passed." ), ) @@ -401,7 +401,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/pytorch/question-answering/run_qa.py b/examples/pytorch/question-answering/run_qa.py index 9063c218729..55029a68d38 100755 --- a/examples/pytorch/question-answering/run_qa.py +++ b/examples/pytorch/question-answering/run_qa.py @@ -100,7 +100,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -391,7 +391,7 @@ def main(): if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/pytorch/question-answering/run_qa_beam_search.py b/examples/pytorch/question-answering/run_qa_beam_search.py index 859bbe9da2a..2f36b6c4d5c 100755 --- a/examples/pytorch/question-answering/run_qa_beam_search.py +++ b/examples/pytorch/question-answering/run_qa_beam_search.py @@ -367,7 +367,7 @@ def main(): if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/pytorch/question-answering/run_qa_beam_search_no_trainer.py b/examples/pytorch/question-answering/run_qa_beam_search_no_trainer.py index dfe01fd3c7c..c28c93e8fb3 100644 --- a/examples/pytorch/question-answering/run_qa_beam_search_no_trainer.py +++ b/examples/pytorch/question-answering/run_qa_beam_search_no_trainer.py @@ -395,7 +395,7 @@ def main(): if args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) diff --git a/examples/pytorch/question-answering/run_qa_no_trainer.py b/examples/pytorch/question-answering/run_qa_no_trainer.py index 3b953964d5d..77582378004 100755 --- a/examples/pytorch/question-answering/run_qa_no_trainer.py +++ b/examples/pytorch/question-answering/run_qa_no_trainer.py @@ -279,7 +279,7 @@ def parse_args(): default=False, help=( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ), ) @@ -306,7 +306,7 @@ def parse_args(): default="all", help=( 'The integration to report the results and logs to. Supported platforms are `"tensorboard"`,' - ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations.' + ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations. ' "Only applicable when `--with_tracking` is passed." ), ) @@ -442,7 +442,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) @@ -471,7 +471,7 @@ def main(): if args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) diff --git a/examples/pytorch/question-answering/run_seq2seq_qa.py b/examples/pytorch/question-answering/run_seq2seq_qa.py index 91fe3f41480..3a91dd6545a 100644 --- a/examples/pytorch/question-answering/run_seq2seq_qa.py +++ b/examples/pytorch/question-answering/run_seq2seq_qa.py @@ -101,7 +101,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -171,7 +171,7 @@ class DataTrainingArguments: metadata={ "help": ( "The maximum total sequence length for validation target text after tokenization. Sequences longer " - "than this will be truncated, sequences shorter will be padded. Will default to `max_answer_length`." + "than this will be truncated, sequences shorter will be padded. Will default to `max_answer_length`. " "This argument is also used to override the ``max_length`` param of ``model.generate``, which is used " "during ``evaluate`` and ``predict``." ) @@ -465,13 +465,13 @@ def main(): if training_args.label_smoothing_factor > 0 and not hasattr(model, "prepare_decoder_input_ids_from_labels"): logger.warning( - "label_smoothing is enabled but the `prepare_decoder_input_ids_from_labels` method is not defined for" + "label_smoothing is enabled but the `prepare_decoder_input_ids_from_labels` method is not defined for " f"`{model.__class__.__name__}`. This will lead to loss being calculated twice and will take up more memory" ) if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/pytorch/semantic-segmentation/run_semantic_segmentation.py b/examples/pytorch/semantic-segmentation/run_semantic_segmentation.py index 9876f79b6d0..cc00d3484b6 100644 --- a/examples/pytorch/semantic-segmentation/run_semantic_segmentation.py +++ b/examples/pytorch/semantic-segmentation/run_semantic_segmentation.py @@ -262,7 +262,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, diff --git a/examples/pytorch/semantic-segmentation/run_semantic_segmentation_no_trainer.py b/examples/pytorch/semantic-segmentation/run_semantic_segmentation_no_trainer.py index fe722f836c5..5eb054cd1f1 100644 --- a/examples/pytorch/semantic-segmentation/run_semantic_segmentation_no_trainer.py +++ b/examples/pytorch/semantic-segmentation/run_semantic_segmentation_no_trainer.py @@ -279,7 +279,7 @@ def parse_args(): default=False, help=( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ), ) @@ -307,7 +307,7 @@ def parse_args(): default="all", help=( 'The integration to report the results and logs to. Supported platforms are `"tensorboard"`,' - ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations.' + ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations. ' "Only applicable when `--with_tracking` is passed." ), ) diff --git a/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py b/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py index 2efbd6e8960..e80e7191715 100755 --- a/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py +++ b/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py @@ -104,8 +104,8 @@ class ModelArguments: default=0.05, metadata={ "help": ( - "Probability of each feature vector along the time axis to be chosen as the start of the vector" - "span to be masked. Approximately ``mask_time_prob * sequence_length // mask_time_length`` feature" + "Probability of each feature vector along the time axis to be chosen as the start of the vector " + "span to be masked. Approximately ``mask_time_prob * sequence_length // mask_time_length`` feature " "vectors will be masked along the time axis." ) }, @@ -249,7 +249,7 @@ class DataTrainingArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -430,7 +430,7 @@ def main(): # Log on each process the small summary: logger.warning( - f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu}" + f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu} " f"distributed training: {training_args.parallel_mode.value == 'distributed'}, 16-bits training: {training_args.fp16}" ) # Set the verbosity to info of the Transformers logger (on main process only): diff --git a/examples/pytorch/speech-recognition/run_speech_recognition_ctc_adapter.py b/examples/pytorch/speech-recognition/run_speech_recognition_ctc_adapter.py index 48d5aa41031..e6ab86829b8 100755 --- a/examples/pytorch/speech-recognition/run_speech_recognition_ctc_adapter.py +++ b/examples/pytorch/speech-recognition/run_speech_recognition_ctc_adapter.py @@ -90,8 +90,8 @@ class ModelArguments: default=0.05, metadata={ "help": ( - "Probability of each feature vector along the time axis to be chosen as the start of the vector" - "span to be masked. Approximately ``mask_time_prob * sequence_length // mask_time_length`` feature" + "Probability of each feature vector along the time axis to be chosen as the start of the vector " + "span to be masked. Approximately ``mask_time_prob * sequence_length // mask_time_length`` feature " "vectors will be masked along the time axis." ) }, @@ -252,7 +252,7 @@ class DataTrainingArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -426,7 +426,7 @@ def main(): # Log on each process the small summary: logger.warning( - f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu}" + f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu} " f"distributed training: {training_args.parallel_mode.value == 'distributed'}, 16-bits training: {training_args.fp16}" ) # Set the verbosity to info of the Transformers logger (on main process only): diff --git a/examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py b/examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py index 52d08e30519..0cd4048c635 100755 --- a/examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py +++ b/examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py @@ -106,7 +106,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -322,7 +322,7 @@ def main(): # Log on each process the small summary: logger.warning( - f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu}" + f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu} " f"distributed training: {training_args.parallel_mode.value == 'distributed'}, 16-bits training: {training_args.fp16}" ) logger.info(f"Training/evaluation parameters {training_args}") diff --git a/examples/pytorch/summarization/run_summarization.py b/examples/pytorch/summarization/run_summarization.py index 5f20aac6cbc..b529bc7f257 100755 --- a/examples/pytorch/summarization/run_summarization.py +++ b/examples/pytorch/summarization/run_summarization.py @@ -120,7 +120,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -205,7 +205,7 @@ class DataTrainingArguments: metadata={ "help": ( "The maximum total sequence length for validation target text after tokenization. Sequences longer " - "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`." + "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`. " "This argument is also used to override the ``max_length`` param of ``model.generate``, which is used " "during ``evaluate`` and ``predict``." ) @@ -271,7 +271,7 @@ class DataTrainingArguments: default=None, metadata={ "help": ( - "The token to force as the first generated token after the decoder_start_token_id." + "The token to force as the first generated token after the decoder_start_token_id. " "Useful for multilingual models like mBART where the first generated token" "needs to be the target language token (Usually it is the target language token)" ) @@ -556,7 +556,7 @@ def main(): if training_args.label_smoothing_factor > 0 and not hasattr(model, "prepare_decoder_input_ids_from_labels"): logger.warning( - "label_smoothing is enabled but the `prepare_decoder_input_ids_from_labels` method is not defined for" + "label_smoothing is enabled but the `prepare_decoder_input_ids_from_labels` method is not defined for " f"`{model.__class__.__name__}`. This will lead to loss being calculated twice and will take up more memory" ) diff --git a/examples/pytorch/summarization/run_summarization_no_trainer.py b/examples/pytorch/summarization/run_summarization_no_trainer.py index 2aec6963de2..c693a8d7db8 100644 --- a/examples/pytorch/summarization/run_summarization_no_trainer.py +++ b/examples/pytorch/summarization/run_summarization_no_trainer.py @@ -146,7 +146,7 @@ def parse_args(): default=128, help=( "The maximum total sequence length for target text after " - "tokenization. Sequences longer than this will be truncated, sequences shorter will be padded." + "tokenization. Sequences longer than this will be truncated, sequences shorter will be padded. " "during ``evaluate`` and ``predict``." ), ) @@ -272,7 +272,7 @@ def parse_args(): default=False, help=( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ), ) @@ -299,7 +299,7 @@ def parse_args(): default="all", help=( 'The integration to report the results and logs to. Supported platforms are `"tensorboard"`,' - ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations.' + ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations. ' "Only applicable when `--with_tracking` is passed." ), ) @@ -433,7 +433,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/pytorch/text-classification/run_classification.py b/examples/pytorch/text-classification/run_classification.py index 7ae557707df..3033a61404e 100755 --- a/examples/pytorch/text-classification/run_classification.py +++ b/examples/pytorch/text-classification/run_classification.py @@ -82,7 +82,7 @@ class DataTrainingArguments: default=None, metadata={ "help": ( - "The name of the text column in the input dataset or a CSV/JSON file." + "The name of the text column in the input dataset or a CSV/JSON file. " 'If not specified, will use the "sentence" column for single/multi-label classifcation task.' ) }, @@ -120,7 +120,7 @@ class DataTrainingArguments: default=None, metadata={ "help": ( - "The name of the label column in the input dataset or a CSV/JSON file." + "The name of the label column in the input dataset or a CSV/JSON file. " 'If not specified, will use the "label" column for single/multi-label classifcation task' ) }, @@ -248,7 +248,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -552,7 +552,7 @@ def main(): if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/pytorch/text-classification/run_glue.py b/examples/pytorch/text-classification/run_glue.py index aaf98e85bd5..b85523822e8 100755 --- a/examples/pytorch/text-classification/run_glue.py +++ b/examples/pytorch/text-classification/run_glue.py @@ -209,7 +209,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -456,7 +456,7 @@ def main(): if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/pytorch/text-classification/run_glue_no_trainer.py b/examples/pytorch/text-classification/run_glue_no_trainer.py index a2942cc10be..9bf5806a9c9 100644 --- a/examples/pytorch/text-classification/run_glue_no_trainer.py +++ b/examples/pytorch/text-classification/run_glue_no_trainer.py @@ -162,7 +162,7 @@ def parse_args(): default=False, help=( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ), ) @@ -189,7 +189,7 @@ def parse_args(): default="all", help=( 'The integration to report the results and logs to. Supported platforms are `"tensorboard"`,' - ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations.' + ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations. ' "Only applicable when `--with_tracking` is passed." ), ) diff --git a/examples/pytorch/text-classification/run_xnli.py b/examples/pytorch/text-classification/run_xnli.py index 95ab10500a1..78a2ba8d77a 100755 --- a/examples/pytorch/text-classification/run_xnli.py +++ b/examples/pytorch/text-classification/run_xnli.py @@ -173,7 +173,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, diff --git a/examples/pytorch/token-classification/run_ner.py b/examples/pytorch/token-classification/run_ner.py index 95a1e1078d5..e8259f03a92 100755 --- a/examples/pytorch/token-classification/run_ner.py +++ b/examples/pytorch/token-classification/run_ner.py @@ -100,7 +100,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, diff --git a/examples/pytorch/token-classification/run_ner_no_trainer.py b/examples/pytorch/token-classification/run_ner_no_trainer.py index c2c6fe58a88..91cbc7a72d2 100755 --- a/examples/pytorch/token-classification/run_ner_no_trainer.py +++ b/examples/pytorch/token-classification/run_ner_no_trainer.py @@ -216,7 +216,7 @@ def parse_args(): default=False, help=( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ), ) @@ -243,7 +243,7 @@ def parse_args(): default="all", help=( 'The integration to report the results and logs to. Supported platforms are `"tensorboard"`,' - ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations.' + ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations. ' "Only applicable when `--with_tracking` is passed." ), ) @@ -412,7 +412,7 @@ def main(): tokenizer_name_or_path = args.tokenizer_name if args.tokenizer_name else args.model_name_or_path if not tokenizer_name_or_path: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/pytorch/translation/run_translation.py b/examples/pytorch/translation/run_translation.py index 5d2bb44f756..ef4f52c482a 100755 --- a/examples/pytorch/translation/run_translation.py +++ b/examples/pytorch/translation/run_translation.py @@ -110,7 +110,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -173,7 +173,7 @@ class DataTrainingArguments: metadata={ "help": ( "The maximum total sequence length for validation target text after tokenization. Sequences longer " - "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`." + "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`. " "This argument is also used to override the ``max_length`` param of ``model.generate``, which is used " "during ``evaluate`` and ``predict``." ) @@ -468,7 +468,7 @@ def main(): if training_args.label_smoothing_factor > 0 and not hasattr(model, "prepare_decoder_input_ids_from_labels"): logger.warning( - "label_smoothing is enabled but the `prepare_decoder_input_ids_from_labels` method is not defined for" + "label_smoothing is enabled but the `prepare_decoder_input_ids_from_labels` method is not defined for " f"`{model.__class__.__name__}`. This will lead to loss being calculated twice and will take up more memory" ) diff --git a/examples/pytorch/translation/run_translation_no_trainer.py b/examples/pytorch/translation/run_translation_no_trainer.py index b4e77d8b664..541608e42ee 100644 --- a/examples/pytorch/translation/run_translation_no_trainer.py +++ b/examples/pytorch/translation/run_translation_no_trainer.py @@ -118,7 +118,7 @@ def parse_args(): default=128, help=( "The maximum total sequence length for target text after " - "tokenization. Sequences longer than this will be truncated, sequences shorter will be padded." + "tokenization. Sequences longer than this will be truncated, sequences shorter will be padded " "during ``evaluate`` and ``predict``." ), ) @@ -139,7 +139,7 @@ def parse_args(): default=False, help=( "Whether to pad all samples to model maximum sentence " - "length. If False, will pad the samples dynamically when batching to the maximum length in the batch. More" + "length. If False, will pad the samples dynamically when batching to the maximum length in the batch. More " "efficient on GPU but very bad for TPU." ), ) @@ -263,7 +263,7 @@ def parse_args(): default=False, help=( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ), ) @@ -290,7 +290,7 @@ def parse_args(): default="all", help=( 'The integration to report the results and logs to. Supported platforms are `"tensorboard"`,' - ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations.' + ' `"wandb"`, `"comet_ml"` and `"clearml"`. Use `"all"` (default) to report to all integrations. ' "Only applicable when `--with_tracking` is passed." ), ) @@ -413,7 +413,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/research_projects/bert-loses-patience/run_glue_with_pabee.py b/examples/research_projects/bert-loses-patience/run_glue_with_pabee.py index 8a59b46ab52..0eb9ef5df37 100755 --- a/examples/research_projects/bert-loses-patience/run_glue_with_pabee.py +++ b/examples/research_projects/bert-loses-patience/run_glue_with_pabee.py @@ -575,7 +575,7 @@ def main(): type=str, default="O1", help=( - "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']." + "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. " "See details at https://nvidia.github.io/apex/amp.html" ), ) diff --git a/examples/research_projects/deebert/run_glue_deebert.py b/examples/research_projects/deebert/run_glue_deebert.py index 6f7cfe65d0e..fef75872a67 100644 --- a/examples/research_projects/deebert/run_glue_deebert.py +++ b/examples/research_projects/deebert/run_glue_deebert.py @@ -532,7 +532,7 @@ def main(): type=str, default="O1", help=( - "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']." + "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. " "See details at https://nvidia.github.io/apex/amp.html" ), ) diff --git a/examples/research_projects/distillation/run_squad_w_distillation.py b/examples/research_projects/distillation/run_squad_w_distillation.py index 4b8b8e542f7..b71965098da 100644 --- a/examples/research_projects/distillation/run_squad_w_distillation.py +++ b/examples/research_projects/distillation/run_squad_w_distillation.py @@ -696,7 +696,7 @@ def main(): type=str, default="O1", help=( - "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']." + "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. " "See details at https://nvidia.github.io/apex/amp.html" ), ) diff --git a/examples/research_projects/distillation/train.py b/examples/research_projects/distillation/train.py index bb35a1df853..1acb527220e 100644 --- a/examples/research_projects/distillation/train.py +++ b/examples/research_projects/distillation/train.py @@ -208,7 +208,7 @@ def main(): type=str, default="O1", help=( - "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']." + "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. " "See details at https://nvidia.github.io/apex/amp.html" ), ) diff --git a/examples/research_projects/information-gain-filtration/run_clm_igf.py b/examples/research_projects/information-gain-filtration/run_clm_igf.py index c1584a2f89a..26b72072784 100644 --- a/examples/research_projects/information-gain-filtration/run_clm_igf.py +++ b/examples/research_projects/information-gain-filtration/run_clm_igf.py @@ -354,7 +354,7 @@ def main(): default=10, type=int, help=( - "decay the selectivity of our secondary learner filter from" + "decay the selectivity of our secondary learner filter from " "1 standard deviation above average to 1 below average after 10 batches" ), ) diff --git a/examples/research_projects/jax-projects/dataset-streaming/run_mlm_flax_stream.py b/examples/research_projects/jax-projects/dataset-streaming/run_mlm_flax_stream.py index 74d4813d45d..fbb165ba42c 100755 --- a/examples/research_projects/jax-projects/dataset-streaming/run_mlm_flax_stream.py +++ b/examples/research_projects/jax-projects/dataset-streaming/run_mlm_flax_stream.py @@ -341,7 +341,7 @@ if __name__ == "__main__": and not training_args.overwrite_output_dir ): raise ValueError( - f"Output directory ({training_args.output_dir}) already exists and is not empty." + f"Output directory ({training_args.output_dir}) already exists and is not empty. " "Use --overwrite_output_dir to overcome." ) @@ -399,7 +399,7 @@ if __name__ == "__main__": ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/research_projects/jax-projects/hybrid_clip/run_hybrid_clip.py b/examples/research_projects/jax-projects/hybrid_clip/run_hybrid_clip.py index c5a4a202534..f954f70ee48 100644 --- a/examples/research_projects/jax-projects/hybrid_clip/run_hybrid_clip.py +++ b/examples/research_projects/jax-projects/hybrid_clip/run_hybrid_clip.py @@ -78,7 +78,7 @@ class ModelArguments: text_model_name_or_path: str = field( metadata={ "help": ( - "The text model checkpoint for weights initialization." + "The text model checkpoint for weights initialization. " "Don't set if you want to train a model from scratch." ) }, @@ -86,7 +86,7 @@ class ModelArguments: vision_model_name_or_path: str = field( metadata={ "help": ( - "The vision model checkpoint for weights initialization." + "The vision model checkpoint for weights initialization. " "Don't set if you want to train a model from scratch." ) }, @@ -311,7 +311,7 @@ def main(): and not training_args.overwrite_output_dir ): raise ValueError( - f"Output directory ({training_args.output_dir}) already exists and is not empty." + f"Output directory ({training_args.output_dir}) already exists and is not empty. " "Use --overwrite_output_dir to overcome." ) @@ -341,7 +341,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/research_projects/jax-projects/model_parallel/run_clm_mp.py b/examples/research_projects/jax-projects/model_parallel/run_clm_mp.py index bb297e3e0db..efe87c1b059 100644 --- a/examples/research_projects/jax-projects/model_parallel/run_clm_mp.py +++ b/examples/research_projects/jax-projects/model_parallel/run_clm_mp.py @@ -246,7 +246,7 @@ def main(): and not training_args.overwrite_output_dir ): raise ValueError( - f"Output directory ({training_args.output_dir}) already exists and is not empty." + f"Output directory ({training_args.output_dir}) already exists and is not empty. " "Use --overwrite_output_dir to overcome." ) @@ -325,7 +325,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) @@ -368,7 +368,7 @@ def main(): else: if data_args.block_size > tokenizer.model_max_length: logger.warning( - f"The block_size passed ({data_args.block_size}) is larger than the maximum length for the model" + f"The block_size passed ({data_args.block_size}) is larger than the maximum length for the model " f"({tokenizer.model_max_length}). Using block_size={tokenizer.model_max_length}." ) block_size = min(data_args.block_size, tokenizer.model_max_length) diff --git a/examples/research_projects/luke/run_luke_ner_no_trainer.py b/examples/research_projects/luke/run_luke_ner_no_trainer.py index f12a7d76d80..c1b573aee81 100644 --- a/examples/research_projects/luke/run_luke_ner_no_trainer.py +++ b/examples/research_projects/luke/run_luke_ner_no_trainer.py @@ -357,7 +357,7 @@ def main(): tokenizer_name_or_path = args.tokenizer_name if args.tokenizer_name else args.model_name_or_path if not tokenizer_name_or_path: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/research_projects/mlm_wwm/run_mlm_wwm.py b/examples/research_projects/mlm_wwm/run_mlm_wwm.py index c7cfa080496..84272421b96 100644 --- a/examples/research_projects/mlm_wwm/run_mlm_wwm.py +++ b/examples/research_projects/mlm_wwm/run_mlm_wwm.py @@ -314,7 +314,7 @@ def main(): tokenizer = AutoTokenizer.from_pretrained(model_args.model_name_or_path, **tokenizer_kwargs) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/research_projects/mm-imdb/run_mmimdb.py b/examples/research_projects/mm-imdb/run_mmimdb.py index 2cc3bc3a0c7..0a784fb1ec8 100644 --- a/examples/research_projects/mm-imdb/run_mmimdb.py +++ b/examples/research_projects/mm-imdb/run_mmimdb.py @@ -426,7 +426,7 @@ def main(): type=str, default="O1", help=( - "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']." + "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. " "See details at https://nvidia.github.io/apex/amp.html" ), ) diff --git a/examples/research_projects/movement-pruning/bertarize.py b/examples/research_projects/movement-pruning/bertarize.py index 0c9cc63571d..da7534f4a6f 100644 --- a/examples/research_projects/movement-pruning/bertarize.py +++ b/examples/research_projects/movement-pruning/bertarize.py @@ -112,8 +112,8 @@ if __name__ == "__main__": type=float, required=False, help=( - "For `magnitude` and `topK`, it is the level of remaining weights (in %) in the fine-pruned model." - "For `sigmoied_threshold`, it is the threshold \tau against which the (sigmoied) scores are compared." + "For `magnitude` and `topK`, it is the level of remaining weights (in %) in the fine-pruned model. " + "For `sigmoied_threshold`, it is the threshold \tau against which the (sigmoied) scores are compared. " "Not needed for `l0`" ), ) diff --git a/examples/research_projects/movement-pruning/counts_parameters.py b/examples/research_projects/movement-pruning/counts_parameters.py index 17ddb029f89..89ce40baa7c 100644 --- a/examples/research_projects/movement-pruning/counts_parameters.py +++ b/examples/research_projects/movement-pruning/counts_parameters.py @@ -79,8 +79,8 @@ if __name__ == "__main__": type=float, required=False, help=( - "For `topK`, it is the level of remaining weights (in %) in the fine-pruned model." - "For `sigmoied_threshold`, it is the threshold \tau against which the (sigmoied) scores are compared." + "For `topK`, it is the level of remaining weights (in %) in the fine-pruned model. " + "For `sigmoied_threshold`, it is the threshold \tau against which the (sigmoied) scores are compared. " "Not needed for `l0`" ), ) diff --git a/examples/research_projects/movement-pruning/masked_run_glue.py b/examples/research_projects/movement-pruning/masked_run_glue.py index a28cdcc583b..f440e627bbe 100644 --- a/examples/research_projects/movement-pruning/masked_run_glue.py +++ b/examples/research_projects/movement-pruning/masked_run_glue.py @@ -671,7 +671,7 @@ def main(): default=1, type=int, help=( - "Run `initial_warmup` * `warmup_steps` steps of threshold warmup during which threshold stays" + "Run `initial_warmup` * `warmup_steps` steps of threshold warmup during which threshold stays " "at its `initial_threshold` value (sparsity schedule)." ), ) @@ -680,7 +680,7 @@ def main(): default=2, type=int, help=( - "Run `final_warmup` * `warmup_steps` steps of threshold cool-down during which threshold stays" + "Run `final_warmup` * `warmup_steps` steps of threshold cool-down during which threshold stays " "at its final_threshold value (sparsity schedule)." ), ) @@ -799,7 +799,7 @@ def main(): type=str, default="O1", help=( - "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']." + "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. " "See details at https://nvidia.github.io/apex/amp.html" ), ) diff --git a/examples/research_projects/movement-pruning/masked_run_squad.py b/examples/research_projects/movement-pruning/masked_run_squad.py index 189ed5be670..14d92dde4e4 100644 --- a/examples/research_projects/movement-pruning/masked_run_squad.py +++ b/examples/research_projects/movement-pruning/masked_run_squad.py @@ -789,7 +789,7 @@ def main(): default=1, type=int, help=( - "Run `initial_warmup` * `warmup_steps` steps of threshold warmup during which threshold stays" + "Run `initial_warmup` * `warmup_steps` steps of threshold warmup during which threshold stays " "at its `initial_threshold` value (sparsity schedule)." ), ) @@ -798,7 +798,7 @@ def main(): default=2, type=int, help=( - "Run `final_warmup` * `warmup_steps` steps of threshold cool-down during which threshold stays" + "Run `final_warmup` * `warmup_steps` steps of threshold cool-down during which threshold stays " "at its final_threshold value (sparsity schedule)." ), ) @@ -946,7 +946,7 @@ def main(): type=str, default="O1", help=( - "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']." + "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. " "See details at https://nvidia.github.io/apex/amp.html" ), ) diff --git a/examples/research_projects/performer/run_mlm_performer.py b/examples/research_projects/performer/run_mlm_performer.py index 42033857eda..c1ff5aa388a 100644 --- a/examples/research_projects/performer/run_mlm_performer.py +++ b/examples/research_projects/performer/run_mlm_performer.py @@ -466,7 +466,7 @@ if __name__ == "__main__": and not training_args.overwrite_output_dir ): raise ValueError( - f"Output directory ({training_args.output_dir}) already exists and is not empty." + f"Output directory ({training_args.output_dir}) already exists and is not empty. " "Use --overwrite_output_dir to overcome." ) @@ -558,7 +558,7 @@ if __name__ == "__main__": ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/research_projects/pplm/run_pplm_discrim_train.py b/examples/research_projects/pplm/run_pplm_discrim_train.py index d53b557d1af..4ac603a33bc 100644 --- a/examples/research_projects/pplm/run_pplm_discrim_train.py +++ b/examples/research_projects/pplm/run_pplm_discrim_train.py @@ -490,8 +490,8 @@ if __name__ == "__main__": default="SST", choices=("SST", "clickbait", "toxic", "generic"), help=( - "dataset to train the discriminator on." - "In case of generic, the dataset is expected" + "dataset to train the discriminator on. " + "In case of generic, the dataset is expected " "to be a TSBV file with structure: class \\t text" ), ) diff --git a/examples/research_projects/quantization-qdqbert/evaluate-hf-trt-qa.py b/examples/research_projects/quantization-qdqbert/evaluate-hf-trt-qa.py index 814f95d0ab8..2055e6f4676 100755 --- a/examples/research_projects/quantization-qdqbert/evaluate-hf-trt-qa.py +++ b/examples/research_projects/quantization-qdqbert/evaluate-hf-trt-qa.py @@ -153,7 +153,7 @@ if args.tokenizer_name: tokenizer = AutoTokenizer.from_pretrained(args.tokenizer_name, use_fast=True) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) @@ -288,7 +288,7 @@ pad_on_right = tokenizer.padding_side == "right" if args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) diff --git a/examples/research_projects/quantization-qdqbert/run_quant_qa.py b/examples/research_projects/quantization-qdqbert/run_quant_qa.py index ba5dfe4c090..bb887955eb4 100755 --- a/examples/research_projects/quantization-qdqbert/run_quant_qa.py +++ b/examples/research_projects/quantization-qdqbert/run_quant_qa.py @@ -365,7 +365,7 @@ def main(): if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/research_projects/rag-end2end-retriever/finetune_rag.py b/examples/research_projects/rag-end2end-retriever/finetune_rag.py index b0a6c183190..9bc2e5db6d5 100644 --- a/examples/research_projects/rag-end2end-retriever/finetune_rag.py +++ b/examples/research_projects/rag-end2end-retriever/finetune_rag.py @@ -680,7 +680,7 @@ class GenerativeQAModule(BaseTransformer): type=int, default=1, help=( - "The number of retrieval actors to use when Ray is selected" + "The number of retrieval actors to use when Ray is selected " "for the distributed retriever. Has no effect when " "distributed_retriever is set to pytorch." ), @@ -719,7 +719,7 @@ def main(args=None, model=None) -> GenerativeQAModule: ray.init(address=args.ray_address, namespace="rag") except (ConnectionError, ValueError): logger.warning( - "Connection to Ray cluster failed. Make sure a Ray" + "Connection to Ray cluster failed. Make sure a Ray " "cluster is running by either using Ray's cluster " "launcher (`ray up`) or by manually starting Ray on " "each node via `ray start --head` for the head node " diff --git a/examples/research_projects/rag-end2end-retriever/lightning_base.py b/examples/research_projects/rag-end2end-retriever/lightning_base.py index b9f8c6e3d7b..276f2f791b9 100644 --- a/examples/research_projects/rag-end2end-retriever/lightning_base.py +++ b/examples/research_projects/rag-end2end-retriever/lightning_base.py @@ -333,7 +333,7 @@ def add_generic_args(parser, root_dir) -> None: type=str, default="O2", help=( - "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']." + "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. " "See details at https://nvidia.github.io/apex/amp.html" ), ) diff --git a/examples/research_projects/rag/finetune_rag.py b/examples/research_projects/rag/finetune_rag.py index 64116a1d53d..7f4778d7d71 100644 --- a/examples/research_projects/rag/finetune_rag.py +++ b/examples/research_projects/rag/finetune_rag.py @@ -525,7 +525,7 @@ class GenerativeQAModule(BaseTransformer): type=int, default=1, help=( - "The number of retrieval actors to use when Ray is selected" + "The number of retrieval actors to use when Ray is selected " "for the distributed retriever. Has no effect when " "distributed_retriever is set to pytorch." ), @@ -552,7 +552,7 @@ def main(args=None, model=None) -> GenerativeQAModule: ray.init(address=args.ray_address, namespace="rag") except (ConnectionError, ValueError): logger.warning( - "Connection to Ray cluster failed. Make sure a Ray" + "Connection to Ray cluster failed. Make sure a Ray " "cluster is running by either using Ray's cluster " "launcher (`ray up`) or by manually starting Ray on " "each node via `ray start --head` for the head node " diff --git a/examples/research_projects/rag/lightning_base.py b/examples/research_projects/rag/lightning_base.py index e78a7582395..12099bc3aa1 100644 --- a/examples/research_projects/rag/lightning_base.py +++ b/examples/research_projects/rag/lightning_base.py @@ -322,7 +322,7 @@ def add_generic_args(parser, root_dir) -> None: type=str, default="O2", help=( - "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']." + "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. " "See details at https://nvidia.github.io/apex/amp.html" ), ) diff --git a/examples/research_projects/robust-speech-event/run_speech_recognition_ctc_bnb.py b/examples/research_projects/robust-speech-event/run_speech_recognition_ctc_bnb.py index f35b42aaa01..7a137eb5fe7 100755 --- a/examples/research_projects/robust-speech-event/run_speech_recognition_ctc_bnb.py +++ b/examples/research_projects/robust-speech-event/run_speech_recognition_ctc_bnb.py @@ -104,8 +104,8 @@ class ModelArguments: default=0.05, metadata={ "help": ( - "Probability of each feature vector along the time axis to be chosen as the start of the vector" - "span to be masked. Approximately ``mask_time_prob * sequence_length // mask_time_length`` feature" + "Probability of each feature vector along the time axis to be chosen as the start of the vector " + "span to be masked. Approximately ``mask_time_prob * sequence_length // mask_time_length`` feature " "vectors will be masked along the time axis." ) }, @@ -399,7 +399,7 @@ def main(): # Log on each process the small summary: logger.warning( - f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu}" + f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu}, " f"distributed training: {bool(training_args.local_rank != -1)}, 16-bits training: {training_args.fp16}" ) # Set the verbosity to info of the Transformers logger (on main process only): diff --git a/examples/research_projects/robust-speech-event/run_speech_recognition_ctc_streaming.py b/examples/research_projects/robust-speech-event/run_speech_recognition_ctc_streaming.py index ea176764271..e3800142e38 100644 --- a/examples/research_projects/robust-speech-event/run_speech_recognition_ctc_streaming.py +++ b/examples/research_projects/robust-speech-event/run_speech_recognition_ctc_streaming.py @@ -103,8 +103,8 @@ class ModelArguments: default=0.05, metadata={ "help": ( - "Probability of each feature vector along the time axis to be chosen as the start of the vector" - "span to be masked. Approximately ``mask_time_prob * sequence_length // mask_time_length`` feature" + "Probability of each feature vector along the time axis to be chosen as the start of the vector " + "span to be masked. Approximately ``mask_time_prob * sequence_length // mask_time_length`` feature " "vectors will be masked along the time axis." ) }, @@ -354,7 +354,7 @@ def main(): # Log on each process the small summary: logger.warning( - f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu}" + f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu}, " f"distributed training: {bool(training_args.local_rank != -1)}, 16-bits training: {training_args.fp16}" ) # Set the verbosity to info of the Transformers logger (on main process only): diff --git a/examples/research_projects/seq2seq-distillation/lightning_base.py b/examples/research_projects/seq2seq-distillation/lightning_base.py index f246ecab0dd..640828bacd3 100644 --- a/examples/research_projects/seq2seq-distillation/lightning_base.py +++ b/examples/research_projects/seq2seq-distillation/lightning_base.py @@ -313,7 +313,7 @@ def add_generic_args(parser, root_dir) -> None: type=str, default="O2", help=( - "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']." + "For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. " "See details at https://nvidia.github.io/apex/amp.html" ), ) diff --git a/examples/research_projects/tapex/run_tabfact_with_tapex.py b/examples/research_projects/tapex/run_tabfact_with_tapex.py index 23d094f8992..17222b8c453 100644 --- a/examples/research_projects/tapex/run_tabfact_with_tapex.py +++ b/examples/research_projects/tapex/run_tabfact_with_tapex.py @@ -325,7 +325,7 @@ def main(): if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/research_projects/tapex/run_wikisql_with_tapex.py b/examples/research_projects/tapex/run_wikisql_with_tapex.py index a5717d245cb..3e72a5ad53d 100644 --- a/examples/research_projects/tapex/run_wikisql_with_tapex.py +++ b/examples/research_projects/tapex/run_wikisql_with_tapex.py @@ -170,7 +170,7 @@ class DataTrainingArguments: metadata={ "help": ( "The maximum total sequence length for validation target text after tokenization. Sequences longer " - "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`." + "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`. " "This argument is also used to override the ``max_length`` param of ``model.generate``, which is used " "during ``evaluate`` and ``predict``." ) @@ -379,7 +379,7 @@ def main(): if training_args.label_smoothing_factor > 0 and not hasattr(model, "prepare_decoder_input_ids_from_labels"): logger.warning( - "label_smoothing is enabled but the `prepare_decoder_input_ids_from_labels` method is not defined for" + "label_smoothing is enabled but the `prepare_decoder_input_ids_from_labels` method is not defined for " f"`{model.__class__.__name__}`. This will lead to loss being calculated twice and will take up more memory" ) diff --git a/examples/research_projects/tapex/run_wikitablequestions_with_tapex.py b/examples/research_projects/tapex/run_wikitablequestions_with_tapex.py index 901e921f26a..bec81a98890 100644 --- a/examples/research_projects/tapex/run_wikitablequestions_with_tapex.py +++ b/examples/research_projects/tapex/run_wikitablequestions_with_tapex.py @@ -168,7 +168,7 @@ class DataTrainingArguments: metadata={ "help": ( "The maximum total sequence length for validation target text after tokenization. Sequences longer " - "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`." + "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`. " "This argument is also used to override the ``max_length`` param of ``model.generate``, which is used " "during ``evaluate`` and ``predict``." ) @@ -377,7 +377,7 @@ def main(): if training_args.label_smoothing_factor > 0 and not hasattr(model, "prepare_decoder_input_ids_from_labels"): logger.warning( - "label_smoothing is enabled but the `prepare_decoder_input_ids_from_labels` method is not defined for" + "label_smoothing is enabled but the `prepare_decoder_input_ids_from_labels` method is not defined for " f"`{model.__class__.__name__}`. This will lead to loss being calculated twice and will take up more memory" ) diff --git a/examples/research_projects/wav2vec2/run_common_voice.py b/examples/research_projects/wav2vec2/run_common_voice.py index 688cef1ba0c..197699ecb0a 100644 --- a/examples/research_projects/wav2vec2/run_common_voice.py +++ b/examples/research_projects/wav2vec2/run_common_voice.py @@ -80,8 +80,8 @@ class ModelArguments: default=0.05, metadata={ "help": ( - "Propability of each feature vector along the time axis to be chosen as the start of the vector" - "span to be masked. Approximately ``mask_time_prob * sequence_length // mask_time_length`` feature" + "Propability of each feature vector along the time axis to be chosen as the start of the vector " + "span to be masked. Approximately ``mask_time_prob * sequence_length // mask_time_length`` feature " "vectors will be masked along the time axis. This is only relevant if ``apply_spec_augment is True``." ) }, diff --git a/examples/research_projects/xtreme-s/run_xtreme_s.py b/examples/research_projects/xtreme-s/run_xtreme_s.py index f00286f3d2b..5db30c7e97e 100644 --- a/examples/research_projects/xtreme-s/run_xtreme_s.py +++ b/examples/research_projects/xtreme-s/run_xtreme_s.py @@ -116,8 +116,8 @@ class ModelArguments: default=0.05, metadata={ "help": ( - "Probability of each feature vector along the time axis to be chosen as the start of the vector" - "span to be masked. Approximately ``mask_time_prob * sequence_length // mask_time_length`` feature" + "Probability of each feature vector along the time axis to be chosen as the start of the vector " + "span to be masked. Approximately ``mask_time_prob * sequence_length // mask_time_length`` feature " "vectors will be masked along the time axis." ) }, @@ -455,7 +455,7 @@ def main(): # Log on each process the small summary: logger.warning( - f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu}" + f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu}, " f"distributed training: {bool(training_args.local_rank != -1)}, 16-bits training: {training_args.fp16}" ) # Set the verbosity to info of the Transformers logger (on main process only): diff --git a/examples/research_projects/zero-shot-distillation/distill_classifier.py b/examples/research_projects/zero-shot-distillation/distill_classifier.py index 3325c3aae05..56181208477 100644 --- a/examples/research_projects/zero-shot-distillation/distill_classifier.py +++ b/examples/research_projects/zero-shot-distillation/distill_classifier.py @@ -41,7 +41,7 @@ class TeacherModelArguments: default="This example is {}.", metadata={ "help": ( - "Template used to turn class names into mock hypotheses for teacher NLI model. Must include {{}}" + "Template used to turn class names into mock hypotheses for teacher NLI model. Must include {{}} " "where class name is inserted." ) }, @@ -53,7 +53,7 @@ class TeacherModelArguments: default=False, metadata={ "help": ( - "Allow multiple classes to be true rather than forcing them to sum to 1 (sometimes called" + "Allow multiple classes to be true rather than forcing them to sum to 1 (sometimes called " "multi-class multi-label classification)." ) }, @@ -98,7 +98,7 @@ class DistillTrainingArguments(TrainingArguments): default=True, metadata={ "help": ( - "Whether to evaluate the agreement of the final student predictions and the teacher predictions" + "Whether to evaluate the agreement of the final student predictions and the teacher predictions " "after training." ) }, @@ -107,7 +107,7 @@ class DistillTrainingArguments(TrainingArguments): default=0, metadata={ "help": ( - "Limit the total amount of checkpoints." + "Limit the total amount of checkpoints. " "Deletes the older checkpoints in the output_dir. Default is 0 (no checkpoints)." ) }, diff --git a/examples/tensorflow/contrastive-image-text/run_clip.py b/examples/tensorflow/contrastive-image-text/run_clip.py index 8d1a87ff15e..4f01216b499 100644 --- a/examples/tensorflow/contrastive-image-text/run_clip.py +++ b/examples/tensorflow/contrastive-image-text/run_clip.py @@ -113,7 +113,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -387,7 +387,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/tensorflow/image-classification/run_image_classification.py b/examples/tensorflow/image-classification/run_image_classification.py index b0b898007f1..99e28dffe3c 100644 --- a/examples/tensorflow/image-classification/run_image_classification.py +++ b/examples/tensorflow/image-classification/run_image_classification.py @@ -178,7 +178,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, diff --git a/examples/tensorflow/language-modeling/run_clm.py b/examples/tensorflow/language-modeling/run_clm.py index 4459f825814..038320f6895 100755 --- a/examples/tensorflow/language-modeling/run_clm.py +++ b/examples/tensorflow/language-modeling/run_clm.py @@ -133,7 +133,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -399,7 +399,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) # endregion @@ -432,7 +432,7 @@ def main(): else: if data_args.block_size > tokenizer.model_max_length: logger.warning( - f"The block_size passed ({data_args.block_size}) is larger than the maximum length for the model" + f"The block_size passed ({data_args.block_size}) is larger than the maximum length for the model " f"({tokenizer.model_max_length}). Using block_size={tokenizer.model_max_length}." ) block_size = min(data_args.block_size, tokenizer.model_max_length) diff --git a/examples/tensorflow/language-modeling/run_mlm.py b/examples/tensorflow/language-modeling/run_mlm.py index ad2e6265482..511301067b5 100755 --- a/examples/tensorflow/language-modeling/run_mlm.py +++ b/examples/tensorflow/language-modeling/run_mlm.py @@ -131,7 +131,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -383,7 +383,7 @@ def main(): ) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) # endregion @@ -404,7 +404,7 @@ def main(): else: if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/tensorflow/multiple-choice/run_swag.py b/examples/tensorflow/multiple-choice/run_swag.py index 284e1b38a3b..a3571cb4269 100644 --- a/examples/tensorflow/multiple-choice/run_swag.py +++ b/examples/tensorflow/multiple-choice/run_swag.py @@ -167,7 +167,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -383,7 +383,7 @@ def main(): else: if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/tensorflow/question-answering/run_qa.py b/examples/tensorflow/question-answering/run_qa.py index 5e6193f0b5e..a2b28092d50 100755 --- a/examples/tensorflow/question-answering/run_qa.py +++ b/examples/tensorflow/question-answering/run_qa.py @@ -98,7 +98,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -400,7 +400,7 @@ def main(): if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/tensorflow/summarization/run_summarization.py b/examples/tensorflow/summarization/run_summarization.py index 82decdb2696..28e77ee4ae1 100644 --- a/examples/tensorflow/summarization/run_summarization.py +++ b/examples/tensorflow/summarization/run_summarization.py @@ -120,7 +120,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -194,7 +194,7 @@ class DataTrainingArguments: metadata={ "help": ( "The maximum total sequence length for validation target text after tokenization. Sequences longer " - "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`." + "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`. " "This argument is also used to override the ``max_length`` param of ``model.generate``, which is used " "during ``evaluate`` and ``predict``." ) diff --git a/examples/tensorflow/text-classification/run_glue.py b/examples/tensorflow/text-classification/run_glue.py index 23d8f2fb214..a3aaecd1368 100644 --- a/examples/tensorflow/text-classification/run_glue.py +++ b/examples/tensorflow/text-classification/run_glue.py @@ -185,7 +185,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -353,7 +353,7 @@ def main(): if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/tensorflow/text-classification/run_text_classification.py b/examples/tensorflow/text-classification/run_text_classification.py index 0d2ea87b96c..3e6adde25f4 100644 --- a/examples/tensorflow/text-classification/run_text_classification.py +++ b/examples/tensorflow/text-classification/run_text_classification.py @@ -101,7 +101,7 @@ class DataTrainingArguments: metadata={ "help": ( "Whether to pad all samples to `max_seq_length`. " - "If False, will pad the samples dynamically when batching to the maximum length in the batch." + "If False, will pad the samples dynamically when batching to the maximum length in the batch. " "Data will always be padded when using TPUs." ) }, @@ -191,7 +191,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -360,7 +360,7 @@ def main(): if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/examples/tensorflow/token-classification/run_ner.py b/examples/tensorflow/token-classification/run_ner.py index f04dae72182..d24f8e5aafb 100644 --- a/examples/tensorflow/token-classification/run_ner.py +++ b/examples/tensorflow/token-classification/run_ner.py @@ -96,7 +96,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -334,7 +334,7 @@ def main(): tokenizer_name_or_path = model_args.tokenizer_name if model_args.tokenizer_name else model_args.model_name_or_path if not tokenizer_name_or_path: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/examples/tensorflow/translation/run_translation.py b/examples/tensorflow/translation/run_translation.py index fa8315cd268..f86d17ba2d3 100644 --- a/examples/tensorflow/translation/run_translation.py +++ b/examples/tensorflow/translation/run_translation.py @@ -114,7 +114,7 @@ class ModelArguments: metadata={ "help": ( "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -182,7 +182,7 @@ class DataTrainingArguments: metadata={ "help": ( "The maximum total sequence length for validation target text after tokenization. Sequences longer " - "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`." + "than this will be truncated, sequences shorter will be padded. Will default to `max_target_length`. " "This argument is also used to override the ``max_length`` param of ``model.generate``, which is used " "during ``evaluate`` and ``predict``." ) diff --git a/src/transformers/commands/serving.py b/src/transformers/commands/serving.py index 803ae71d1c1..ea4276d9b83 100644 --- a/src/transformers/commands/serving.py +++ b/src/transformers/commands/serving.py @@ -131,7 +131,7 @@ class ServeCommand(BaseTransformersCLICommand): if not _serve_dependencies_installed: raise RuntimeError( "Using serve command requires FastAPI and uvicorn. " - 'Please install transformers with [serving]: pip install "transformers[serving]".' + 'Please install transformers with [serving]: pip install "transformers[serving]". ' "Or install FastAPI and uvicorn separately." ) else: diff --git a/src/transformers/dynamic_module_utils.py b/src/transformers/dynamic_module_utils.py index cd875b7b413..7aba154b71e 100644 --- a/src/transformers/dynamic_module_utils.py +++ b/src/transformers/dynamic_module_utils.py @@ -575,7 +575,7 @@ def custom_object_save(obj: Any, folder: Union[str, os.PathLike], config: Option def _raise_timeout_error(signum, frame): raise ValueError( - "Loading this model requires you to execute custom code contained in the model repository on your local" + "Loading this model requires you to execute custom code contained in the model repository on your local " "machine. Please set the option `trust_remote_code=True` to permit loading of this model." ) @@ -593,7 +593,7 @@ def resolve_trust_remote_code(trust_remote_code, model_name, has_local_code, has signal.alarm(TIME_OUT_REMOTE_CODE) while trust_remote_code is None: answer = input( - f"The repository for {model_name} contains custom code which must be executed to correctly" + f"The repository for {model_name} contains custom code which must be executed to correctly " f"load the model. You can inspect the repository content at https://hf.co/{model_name}.\n" f"You can avoid this prompt in future by passing the argument `trust_remote_code=True`.\n\n" f"Do you wish to run the custom code? [y/N] " @@ -606,7 +606,7 @@ def resolve_trust_remote_code(trust_remote_code, model_name, has_local_code, has except Exception: # OS which does not support signal.SIGALRM raise ValueError( - f"The repository for {model_name} contains custom code which must be executed to correctly" + f"The repository for {model_name} contains custom code which must be executed to correctly " f"load the model. You can inspect the repository content at https://hf.co/{model_name}.\n" f"Please pass the argument `trust_remote_code=True` to allow custom code to be run." ) diff --git a/src/transformers/generation/tf_utils.py b/src/transformers/generation/tf_utils.py index 3c3d7c55314..65906dc139c 100644 --- a/src/transformers/generation/tf_utils.py +++ b/src/transformers/generation/tf_utils.py @@ -1198,7 +1198,7 @@ class TFGenerationMixin: inputs_kwarg = model_kwargs.pop(input_name, None) if inputs_kwarg is not None and inputs is not None: raise ValueError( - f"`inputs`: {inputs}` were passed alongside {input_name} which is not allowed." + f"`inputs`: {inputs}` were passed alongside {input_name} which is not allowed. " f"Make sure to either pass {inputs} or {input_name}=..." ) elif inputs_kwarg is not None: diff --git a/src/transformers/generation/utils.py b/src/transformers/generation/utils.py index a104113af89..c9791653286 100644 --- a/src/transformers/generation/utils.py +++ b/src/transformers/generation/utils.py @@ -544,7 +544,7 @@ class GenerationMixin: inputs_kwarg = model_kwargs.pop(input_name, None) if inputs_kwarg is not None and inputs is not None: raise ValueError( - f"`inputs`: {inputs}` were passed alongside {input_name} which is not allowed." + f"`inputs`: {inputs}` were passed alongside {input_name} which is not allowed. " f"Make sure to either pass {inputs} or {input_name}=..." ) elif inputs_kwarg is not None: @@ -1816,7 +1816,7 @@ class GenerationMixin: def typeerror(): raise ValueError( - "`force_words_ids` has to either be a `List[List[List[int]]]` or `List[List[int]]`" + "`force_words_ids` has to either be a `List[List[List[int]]]` or `List[List[int]]` " f"of positive integers, but is {generation_config.force_words_ids}." ) diff --git a/src/transformers/integrations/integration_utils.py b/src/transformers/integrations/integration_utils.py index 10f86ee4198..5911d341934 100644 --- a/src/transformers/integrations/integration_utils.py +++ b/src/transformers/integrations/integration_utils.py @@ -1312,7 +1312,7 @@ class NeptuneCallback(TrainerCallback): target_path = consistent_checkpoint_path except IOError as e: logger.warning( - "NeptuneCallback was unable to made a copy of checkpoint due to I/O exception: '{}'." + "NeptuneCallback was unable to made a copy of checkpoint due to I/O exception: '{}'. " "Could fail trying to upload.".format(e) ) diff --git a/src/transformers/modeling_tf_utils.py b/src/transformers/modeling_tf_utils.py index 6505a2ec6dd..150fcba2af4 100644 --- a/src/transformers/modeling_tf_utils.py +++ b/src/transformers/modeling_tf_utils.py @@ -850,7 +850,7 @@ def load_tf_shard(model, model_layer_map, resolved_archive_file, ignore_mismatch raise OSError( f"Unable to load weights from TF checkpoint file for '{resolved_archive_file}' " f"at '{resolved_archive_file}'. " - "If you tried to load a TF model from a sharded checkpoint, you should try converting the model" + "If you tried to load a TF model from a sharded checkpoint, you should try converting the model " "by loading it in pytorch and saving it localy. A convertion script should be realeased soon." ) diff --git a/src/transformers/modeling_utils.py b/src/transformers/modeling_utils.py index 54f31ab926b..95694a867d2 100644 --- a/src/transformers/modeling_utils.py +++ b/src/transformers/modeling_utils.py @@ -2635,8 +2635,8 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix else: raise RuntimeError("No GPU found. A GPU is needed for quantization.") logger.info( - "The device_map was not initialized." - "Setting device_map to {'':torch.cuda.current_device()}." + "The device_map was not initialized. " + "Setting device_map to {'':torch.cuda.current_device()}. " "If you want to use the model for inference, please set device_map ='auto' " ) if low_cpu_mem_usage is None: @@ -2762,8 +2762,8 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix else: raise RuntimeError("No GPU found. A GPU is needed for quantization.") logger.info( - "The device_map was not initialized." - "Setting device_map to {'':torch.cuda.current_device()}." + "The device_map was not initialized. " + "Setting device_map to {'':torch.cuda.current_device()}. " "If you want to use the model for inference, please set device_map ='auto' " ) if low_cpu_mem_usage is None: @@ -3149,7 +3149,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix if load_in_8bit and torch_dtype is None: logger.warning( - "You are loading your model in 8bit but you did not specify a `torch_dtype` attribute." + "You are loading your model in 8bit but you did not specify a `torch_dtype` attribute. " "All non-linear modules will be loaded in full precision." " If you want to load the other modules in other precision, please specify a `torch_dtype` attribute." ) @@ -3193,8 +3193,8 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix else: raise ValueError( "You are using `device_map='auto'` on a 4bit loaded version of the model. To automatically compute" - " the appropriate device map, you should upgrade your `accelerate` library," - "`pip install --upgrade accelerate` or install it from source to support fp4 auto device map" + " the appropriate device map, you should upgrade your `accelerate` library, " + "`pip install --upgrade accelerate` or install it from source to support fp4 auto device map " "calculation. You may encounter unexpected behavior, or pass your own device map" ) elif load_in_8bit: @@ -3202,7 +3202,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix if model._no_split_modules is None: raise ValueError( - f"{model.__class__.__name__} does not support `device_map='{device_map}'`. To implement support, the model" + f"{model.__class__.__name__} does not support `device_map='{device_map}'`. To implement support, the model " "class needs to implement the `_no_split_modules` attribute." ) no_split_modules = model._no_split_modules diff --git a/src/transformers/models/auto/processing_auto.py b/src/transformers/models/auto/processing_auto.py index b9c0c23e54e..9f69dfc878c 100644 --- a/src/transformers/models/auto/processing_auto.py +++ b/src/transformers/models/auto/processing_auto.py @@ -314,7 +314,7 @@ class AutoProcessor: raise ValueError( f"Unrecognized processing class in {pretrained_model_name_or_path}. Can't instantiate a processor, a " - "tokenizer, an image processor or a feature extractor for this model. Make sure the repository contains" + "tokenizer, an image processor or a feature extractor for this model. Make sure the repository contains " "the files of at least one of those processing classes." ) diff --git a/src/transformers/models/codegen/tokenization_codegen_fast.py b/src/transformers/models/codegen/tokenization_codegen_fast.py index fad5e24dbcf..010ddf01d22 100644 --- a/src/transformers/models/codegen/tokenization_codegen_fast.py +++ b/src/transformers/models/codegen/tokenization_codegen_fast.py @@ -144,7 +144,7 @@ class CodeGenTokenizerFast(PreTrainedTokenizerFast): if kwargs.pop("add_bos_token", False): model_id = kwargs.pop("name_or_path", "") raise ValueError( - "Currenty GPT2's fast tokenizer does NOT support adding a BOS token." + "Currenty GPT2's fast tokenizer does NOT support adding a BOS token. " "Instead you should use GPT2's slow tokenizer class `CodeGenTokenizer` as follows: \n" f"`CodeGenTokenizer.from_pretrained('{model_id}')`\nor\n" f"`AutoTokenizer.from_pretrained('{model_id}', use_fast=False)`\n" diff --git a/src/transformers/models/conditional_detr/image_processing_conditional_detr.py b/src/transformers/models/conditional_detr/image_processing_conditional_detr.py index c2b28cd57d9..626911a94bc 100644 --- a/src/transformers/models/conditional_detr/image_processing_conditional_detr.py +++ b/src/transformers/models/conditional_detr/image_processing_conditional_detr.py @@ -1233,7 +1233,7 @@ class ConditionalDetrImageProcessor(BaseImageProcessor): if annotations is not None: if format == AnnotionFormat.COCO_DETECTION and not valid_coco_detection_annotations(annotations): raise ValueError( - "Invalid COCO detection annotations. Annotations must a dict (single image) of list of dicts" + "Invalid COCO detection annotations. Annotations must a dict (single image) of list of dicts " "(batch of images) with the following keys: `image_id` and `annotations`, with the latter " "being a list of annotations in the COCO format." ) diff --git a/src/transformers/models/data2vec/modeling_data2vec_audio.py b/src/transformers/models/data2vec/modeling_data2vec_audio.py index b886c6ad48c..4435e9b8d01 100755 --- a/src/transformers/models/data2vec/modeling_data2vec_audio.py +++ b/src/transformers/models/data2vec/modeling_data2vec_audio.py @@ -991,7 +991,7 @@ class Data2VecAudioForCTC(Data2VecAudioPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1116,7 +1116,7 @@ class Data2VecAudioForSequenceClassification(Data2VecAudioPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1237,7 +1237,7 @@ class Data2VecAudioForAudioFrameClassification(Data2VecAudioPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1403,7 +1403,7 @@ class Data2VecAudioForXVector(Data2VecAudioPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) diff --git a/src/transformers/models/deformable_detr/image_processing_deformable_detr.py b/src/transformers/models/deformable_detr/image_processing_deformable_detr.py index ae35a07e43d..5bbde326eaa 100644 --- a/src/transformers/models/deformable_detr/image_processing_deformable_detr.py +++ b/src/transformers/models/deformable_detr/image_processing_deformable_detr.py @@ -1231,7 +1231,7 @@ class DeformableDetrImageProcessor(BaseImageProcessor): if annotations is not None: if format == AnnotionFormat.COCO_DETECTION and not valid_coco_detection_annotations(annotations): raise ValueError( - "Invalid COCO detection annotations. Annotations must a dict (single image) of list of dicts" + "Invalid COCO detection annotations. Annotations must a dict (single image) of list of dicts " "(batch of images) with the following keys: `image_id` and `annotations`, with the latter " "being a list of annotations in the COCO format." ) diff --git a/src/transformers/models/deta/image_processing_deta.py b/src/transformers/models/deta/image_processing_deta.py index 568990f536c..f1262728626 100644 --- a/src/transformers/models/deta/image_processing_deta.py +++ b/src/transformers/models/deta/image_processing_deta.py @@ -895,7 +895,7 @@ class DetaImageProcessor(BaseImageProcessor): if annotations is not None: if format == AnnotionFormat.COCO_DETECTION and not valid_coco_detection_annotations(annotations): raise ValueError( - "Invalid COCO detection annotations. Annotations must a dict (single image) of list of dicts" + "Invalid COCO detection annotations. Annotations must a dict (single image) of list of dicts " "(batch of images) with the following keys: `image_id` and `annotations`, with the latter " "being a list of annotations in the COCO format." ) diff --git a/src/transformers/models/detr/image_processing_detr.py b/src/transformers/models/detr/image_processing_detr.py index 816fad102b5..e48536463b7 100644 --- a/src/transformers/models/detr/image_processing_detr.py +++ b/src/transformers/models/detr/image_processing_detr.py @@ -1203,7 +1203,7 @@ class DetrImageProcessor(BaseImageProcessor): if annotations is not None: if format == AnnotionFormat.COCO_DETECTION and not valid_coco_detection_annotations(annotations): raise ValueError( - "Invalid COCO detection annotations. Annotations must a dict (single image) of list of dicts" + "Invalid COCO detection annotations. Annotations must a dict (single image) of list of dicts " "(batch of images) with the following keys: `image_id` and `annotations`, with the latter " "being a list of annotations in the COCO format." ) diff --git a/src/transformers/models/esm/modeling_esmfold.py b/src/transformers/models/esm/modeling_esmfold.py index 9bdb5b4eb74..a0e9ebcc2d6 100644 --- a/src/transformers/models/esm/modeling_esmfold.py +++ b/src/transformers/models/esm/modeling_esmfold.py @@ -1204,7 +1204,7 @@ class EsmFoldTriangularSelfAttentionBlock(nn.Module): if sequence_state_dim != self.config.sequence_state_dim: raise ValueError( - "`sequence_state` last dimension should be equal to `self.sequence_state_dim`. Got" + "`sequence_state` last dimension should be equal to `self.sequence_state_dim`. Got " f"{sequence_state_dim} != {self.config.sequence_state_dim}." ) if pairwise_state_dim != self.config.pairwise_state_dim: diff --git a/src/transformers/models/gptsan_japanese/modeling_gptsan_japanese.py b/src/transformers/models/gptsan_japanese/modeling_gptsan_japanese.py index 0d9301406da..24917fcfdb0 100644 --- a/src/transformers/models/gptsan_japanese/modeling_gptsan_japanese.py +++ b/src/transformers/models/gptsan_japanese/modeling_gptsan_japanese.py @@ -770,7 +770,7 @@ class GPTSanJapanesePreTrainedModel(PreTrainedModel): if decoder_start_token_id is None: raise ValueError( - "self.model.config.decoder_start_token_id has to be defined. In T5 it is usually set to the pad_token_id." + "self.model.config.decoder_start_token_id has to be defined. In T5 it is usually set to the pad_token_id. " "See T5 docs for more information." ) diff --git a/src/transformers/models/groupvit/modeling_tf_groupvit.py b/src/transformers/models/groupvit/modeling_tf_groupvit.py index 027117bdce2..373cfcbb83d 100644 --- a/src/transformers/models/groupvit/modeling_tf_groupvit.py +++ b/src/transformers/models/groupvit/modeling_tf_groupvit.py @@ -58,7 +58,7 @@ if is_tensorflow_probability_available(): _ = tfp.distributions.Normal(loc=0.0, scale=1.0) except ImportError: logger.error( - "GroupViT models are not usable since `tensorflow_probability` can't be loaded." + "GroupViT models are not usable since `tensorflow_probability` can't be loaded. " "It seems you have `tensorflow_probability` installed with the wrong tensorflow version." "Please try to reinstall it following the instructions here: https://github.com/tensorflow/probability." ) diff --git a/src/transformers/models/hubert/modeling_hubert.py b/src/transformers/models/hubert/modeling_hubert.py index 948530bb6b3..1a7bde45efc 100755 --- a/src/transformers/models/hubert/modeling_hubert.py +++ b/src/transformers/models/hubert/modeling_hubert.py @@ -1183,7 +1183,7 @@ class HubertForCTC(HubertPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1316,7 +1316,7 @@ class HubertForSequenceClassification(HubertPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) diff --git a/src/transformers/models/hubert/modeling_tf_hubert.py b/src/transformers/models/hubert/modeling_tf_hubert.py index 2c4d4debeac..12c08cbaf1f 100644 --- a/src/transformers/models/hubert/modeling_tf_hubert.py +++ b/src/transformers/models/hubert/modeling_tf_hubert.py @@ -1364,7 +1364,7 @@ class TFHubertForCTC(TFHubertPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) diff --git a/src/transformers/models/idefics/vision.py b/src/transformers/models/idefics/vision.py index 8b7a14c56a2..d4966a240d8 100644 --- a/src/transformers/models/idefics/vision.py +++ b/src/transformers/models/idefics/vision.py @@ -115,8 +115,8 @@ class IdeficsVisionEmbeddings(nn.Module): fp32_upcasting = patch_pos_embed.dtype == torch.bfloat16 if fp32_upcasting: logger.warning_once( - "Upcasting patch_pos_embed to fp32 for interpolation since `upsample_bicubic2d_out_frame` in nn.functional.interpolate" - "is not implemented for 'torch.bfloat16' dtype. This will result in a slight overhead" + "Upcasting patch_pos_embed to fp32 for interpolation since `upsample_bicubic2d_out_frame` in nn.functional.interpolate " + "is not implemented for 'torch.bfloat16' dtype. This will result in a slight overhead." ) patch_pos_embed = patch_pos_embed.to(torch.float) patch_pos_embed = nn.functional.interpolate( diff --git a/src/transformers/models/longt5/configuration_longt5.py b/src/transformers/models/longt5/configuration_longt5.py index 0927d130346..b9a67a970b1 100644 --- a/src/transformers/models/longt5/configuration_longt5.py +++ b/src/transformers/models/longt5/configuration_longt5.py @@ -135,7 +135,7 @@ class LongT5Config(PretrainedConfig): if len(act_info) > 1 and act_info[0] != "gated" or len(act_info) > 2: raise ValueError( - f"`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer." + f"`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer. " "Please make sure `feed_forward_proj` is of the format `gated-{ACT_FN}` or `{ACT_FN}`, e.g. " "'gated-gelu' or 'relu'" ) diff --git a/src/transformers/models/longt5/modeling_longt5.py b/src/transformers/models/longt5/modeling_longt5.py index 4e8aef06783..c80d2349832 100644 --- a/src/transformers/models/longt5/modeling_longt5.py +++ b/src/transformers/models/longt5/modeling_longt5.py @@ -1352,7 +1352,7 @@ class LongT5PreTrainedModel(PreTrainedModel): if decoder_start_token_id is None: raise ValueError( - "self.model.config.decoder_start_token_id has to be defined. In LongT5 it is usually set to the pad_token_id." + "self.model.config.decoder_start_token_id has to be defined. In LongT5 it is usually set to the pad_token_id. " "See LongT5 docs for more information." ) diff --git a/src/transformers/models/mt5/configuration_mt5.py b/src/transformers/models/mt5/configuration_mt5.py index b1bb201bebc..93b7c42d345 100644 --- a/src/transformers/models/mt5/configuration_mt5.py +++ b/src/transformers/models/mt5/configuration_mt5.py @@ -129,7 +129,7 @@ class MT5Config(PretrainedConfig): if len(act_info) > 1 and act_info[0] != "gated" or len(act_info) > 2: raise ValueError( - f"`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer." + f"`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer. " "Please make sure `feed_forward_proj` is of the format `gated-{ACT_FN}` or `{ACT_FN}`, e.g. " "'gated-gelu' or 'relu'" ) diff --git a/src/transformers/models/mt5/modeling_mt5.py b/src/transformers/models/mt5/modeling_mt5.py index 0de50afe9d6..186db94dad7 100644 --- a/src/transformers/models/mt5/modeling_mt5.py +++ b/src/transformers/models/mt5/modeling_mt5.py @@ -855,7 +855,7 @@ class MT5PreTrainedModel(PreTrainedModel): if decoder_start_token_id is None: raise ValueError( - "self.model.config.decoder_start_token_id has to be defined. In MT5 it is usually set to the pad_token_id." + "self.model.config.decoder_start_token_id has to be defined. In MT5 it is usually set to the pad_token_id. " "See MT5 docs for more information." ) diff --git a/src/transformers/models/musicgen/modeling_musicgen.py b/src/transformers/models/musicgen/modeling_musicgen.py index 16766e953c8..bcc6bc82a2f 100644 --- a/src/transformers/models/musicgen/modeling_musicgen.py +++ b/src/transformers/models/musicgen/modeling_musicgen.py @@ -1428,7 +1428,7 @@ class MusicgenForCausalLM(MusicgenPreTrainedModel): else: raise ValueError( - "Got incompatible mode for generation, should be one of greedy or sampling." + "Got incompatible mode for generation, should be one of greedy or sampling. " "Ensure that beam search is de-activated by setting `num_beams=1` and `num_beam_groups=1`." ) @@ -1453,7 +1453,7 @@ class MusicgenForCausalLM(MusicgenPreTrainedModel): @add_start_docstrings( - "The composite MusicGen model with a text encoder, audio encoder and Musicgen decoder," + "The composite MusicGen model with a text encoder, audio encoder and Musicgen decoder, " "for music generation tasks with one or both of text and audio prompts.", MUSICGEN_START_DOCSTRING, ) @@ -2475,7 +2475,7 @@ class MusicgenForConditionalGeneration(PreTrainedModel): else: raise ValueError( - "Got incompatible mode for generation, should be one of greedy or sampling." + "Got incompatible mode for generation, should be one of greedy or sampling. " "Ensure that beam search is de-activated by setting `num_beams=1` and `num_beam_groups=1`." ) diff --git a/src/transformers/models/oneformer/convert_to_hf_oneformer.py b/src/transformers/models/oneformer/convert_to_hf_oneformer.py index cb93857ad8e..6e88d8a0555 100644 --- a/src/transformers/models/oneformer/convert_to_hf_oneformer.py +++ b/src/transformers/models/oneformer/convert_to_hf_oneformer.py @@ -1118,7 +1118,7 @@ if __name__ == "__main__": required=True, type=Path, help=( - "A path to OneFormer's original implementation directory. You can download from here:" + "A path to OneFormer's original implementation directory. You can download from here: " "https://github.com/SHI-Labs/OneFormer" ), ) diff --git a/src/transformers/models/pix2struct/modeling_pix2struct.py b/src/transformers/models/pix2struct/modeling_pix2struct.py index e19761803e2..58041820c1f 100644 --- a/src/transformers/models/pix2struct/modeling_pix2struct.py +++ b/src/transformers/models/pix2struct/modeling_pix2struct.py @@ -481,7 +481,7 @@ class Pix2StructPreTrainedModel(PreTrainedModel): if decoder_start_token_id is None: raise ValueError( - "self.model.config.decoder_start_token_id has to be defined. In Pix2Struct it is usually set to the pad_token_id." + "self.model.config.decoder_start_token_id has to be defined. In Pix2Struct it is usually set to the pad_token_id. " "See Pix2Struct docs for more information." ) diff --git a/src/transformers/models/pop2piano/feature_extraction_pop2piano.py b/src/transformers/models/pop2piano/feature_extraction_pop2piano.py index d0e50b1c173..3c14085c21a 100644 --- a/src/transformers/models/pop2piano/feature_extraction_pop2piano.py +++ b/src/transformers/models/pop2piano/feature_extraction_pop2piano.py @@ -407,9 +407,9 @@ class Pop2PianoFeatureExtractor(SequenceFeatureExtractor): ) else: warnings.warn( - f"The sampling_rate of the provided audio is different from the target sampling_rate" + f"The sampling_rate of the provided audio is different from the target sampling_rate " f"of the Feature Extractor, {self.sampling_rate} vs {single_sampling_rate}. " - f"In these cases it is recommended to use `resample=True` in the `__call__` method to" + f"In these cases it is recommended to use `resample=True` in the `__call__` method to " f"get the optimal behaviour." ) diff --git a/src/transformers/models/sew/configuration_sew.py b/src/transformers/models/sew/configuration_sew.py index 831d95f54d1..662eaff7f26 100644 --- a/src/transformers/models/sew/configuration_sew.py +++ b/src/transformers/models/sew/configuration_sew.py @@ -229,9 +229,9 @@ class SEWConfig(PretrainedConfig): or (len(self.conv_dim) != self.num_feat_extract_layers) ): raise ValueError( - "Configuration for convolutional layers is incorrect." - "It is required that `len(config.conv_dim)` == `len(config.conv_stride)` == `len(config.conv_kernel)`," - f"but is `len(config.conv_dim) = {len(self.conv_dim)}`, `len(config.conv_stride)" + "Configuration for convolutional layers is incorrect. " + "It is required that `len(config.conv_dim)` == `len(config.conv_stride)` == `len(config.conv_kernel)`, " + f"but is `len(config.conv_dim) = {len(self.conv_dim)}`, `len(config.conv_stride) " f"= {len(self.conv_stride)}`, `len(config.conv_kernel) = {len(self.conv_kernel)}`." ) diff --git a/src/transformers/models/sew/modeling_sew.py b/src/transformers/models/sew/modeling_sew.py index 17364a255b9..34f9c84235c 100644 --- a/src/transformers/models/sew/modeling_sew.py +++ b/src/transformers/models/sew/modeling_sew.py @@ -1018,7 +1018,7 @@ class SEWForCTC(SEWPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1151,7 +1151,7 @@ class SEWForSequenceClassification(SEWPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) diff --git a/src/transformers/models/sew_d/configuration_sew_d.py b/src/transformers/models/sew_d/configuration_sew_d.py index 460c05cf245..78c0f2a7125 100644 --- a/src/transformers/models/sew_d/configuration_sew_d.py +++ b/src/transformers/models/sew_d/configuration_sew_d.py @@ -256,9 +256,9 @@ class SEWDConfig(PretrainedConfig): or (len(self.conv_dim) != self.num_feat_extract_layers) ): raise ValueError( - "Configuration for convolutional layers is incorrect." - "It is required that `len(config.conv_dim)` == `len(config.conv_stride)` == `len(config.conv_kernel)`," - f"but is `len(config.conv_dim) = {len(self.conv_dim)}`, `len(config.conv_stride)" + "Configuration for convolutional layers is incorrect. " + "It is required that `len(config.conv_dim)` == `len(config.conv_stride)` == `len(config.conv_kernel)`, " + f"but is `len(config.conv_dim) = {len(self.conv_dim)}`, `len(config.conv_stride) " f"= {len(self.conv_stride)}`, `len(config.conv_kernel) = {len(self.conv_kernel)}`." ) diff --git a/src/transformers/models/sew_d/modeling_sew_d.py b/src/transformers/models/sew_d/modeling_sew_d.py index fbc6c4ced27..661a8c03b1a 100644 --- a/src/transformers/models/sew_d/modeling_sew_d.py +++ b/src/transformers/models/sew_d/modeling_sew_d.py @@ -1558,7 +1558,7 @@ class SEWDForCTC(SEWDPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1691,7 +1691,7 @@ class SEWDForSequenceClassification(SEWDPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) diff --git a/src/transformers/models/speech_to_text_2/tokenization_speech_to_text_2.py b/src/transformers/models/speech_to_text_2/tokenization_speech_to_text_2.py index e28b8a62d01..074576a6c0e 100644 --- a/src/transformers/models/speech_to_text_2/tokenization_speech_to_text_2.py +++ b/src/transformers/models/speech_to_text_2/tokenization_speech_to_text_2.py @@ -199,7 +199,7 @@ class Speech2Text2Tokenizer(PreTrainedTokenizer): if self.bpe_ranks is None: raise ValueError( "This tokenizer was instantiated without a `merges.txt` file, so" - " that it can only be used for decoding, not for encoding." + " that it can only be used for decoding, not for encoding. " "Make sure to provide `merges.txt` file at instantiation to enable " "encoding." ) diff --git a/src/transformers/models/switch_transformers/modeling_switch_transformers.py b/src/transformers/models/switch_transformers/modeling_switch_transformers.py index 541db4382dd..0a402ea2d6a 100644 --- a/src/transformers/models/switch_transformers/modeling_switch_transformers.py +++ b/src/transformers/models/switch_transformers/modeling_switch_transformers.py @@ -1774,13 +1774,13 @@ class SwitchTransformersForConditionalGeneration(SwitchTransformersPreTrainedMod if reordered_layer_past_states[0].shape != layer_past_states[0].shape: raise ValueError( - "expected reordered_layer_past_states to have the same shape than layer_past_states" + "expected reordered_layer_past_states to have the same shape than layer_past_states, " f"but got {reordered_layer_past_states[0].shape} and {layer_past_states[0].shape}" ) if len(reordered_layer_past_states) != len(layer_past_states): raise ValueError( - "expected layer_past_states to have the same length as reordered_layer_past_states" - f"got {len(layer_past_states)} and {len(reordered_layer_past_states)}" + "expected layer_past_states to have the same length as reordered_layer_past_states, " + f"but got {len(layer_past_states)} and {len(reordered_layer_past_states)}" ) reordered_decoder_past = reordered_decoder_past + (reordered_layer_past_states,) diff --git a/src/transformers/models/t5/configuration_t5.py b/src/transformers/models/t5/configuration_t5.py index 7eb621f5882..10afdea0c1e 100644 --- a/src/transformers/models/t5/configuration_t5.py +++ b/src/transformers/models/t5/configuration_t5.py @@ -127,7 +127,7 @@ class T5Config(PretrainedConfig): if len(act_info) > 1 and act_info[0] != "gated" or len(act_info) > 2: raise ValueError( - f"`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer." + f"`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer. " "Please make sure `feed_forward_proj` is of the format `gated-{ACT_FN}` or `{ACT_FN}`, e.g. " "'gated-gelu' or 'relu'" ) diff --git a/src/transformers/models/t5/modeling_t5.py b/src/transformers/models/t5/modeling_t5.py index 9716c7ffaff..0e7237ea36b 100644 --- a/src/transformers/models/t5/modeling_t5.py +++ b/src/transformers/models/t5/modeling_t5.py @@ -883,7 +883,7 @@ class T5PreTrainedModel(PreTrainedModel): if decoder_start_token_id is None: raise ValueError( - "self.model.config.decoder_start_token_id has to be defined. In T5 it is usually set to the pad_token_id." + "self.model.config.decoder_start_token_id has to be defined. In T5 it is usually set to the pad_token_id. " "See T5 docs for more information." ) diff --git a/src/transformers/models/t5/modeling_tf_t5.py b/src/transformers/models/t5/modeling_tf_t5.py index 5454b8186c7..f0de49645a9 100644 --- a/src/transformers/models/t5/modeling_tf_t5.py +++ b/src/transformers/models/t5/modeling_tf_t5.py @@ -555,7 +555,7 @@ class TFT5Block(tf.keras.layers.Layer): if len(past_key_value) != expected_num_past_key_values: raise ValueError( f"There should be {expected_num_past_key_values} past states. " - f"{'2 (past / key) for cross attention' if expected_num_past_key_values == 4 else ''}." + f"{'2 (past / key) for cross attention' if expected_num_past_key_values == 4 else ''}. " f"Got {len(past_key_value)} past key / value states" ) diff --git a/src/transformers/models/tapas/modeling_tf_tapas.py b/src/transformers/models/tapas/modeling_tf_tapas.py index 62e77a6678d..a41b56e1a6c 100644 --- a/src/transformers/models/tapas/modeling_tf_tapas.py +++ b/src/transformers/models/tapas/modeling_tf_tapas.py @@ -66,8 +66,8 @@ if is_tensorflow_probability_available(): n = tfp.distributions.Normal(loc=0.0, scale=1.0) except ImportError: logger.error( - "TAPAS models are not usable since `tensorflow_probability` can't be loaded." - "It seems you have `tensorflow_probability` installed with the wrong tensorflow version." + "TAPAS models are not usable since `tensorflow_probability` can't be loaded. " + "It seems you have `tensorflow_probability` installed with the wrong tensorflow version. " "Please try to reinstall it following the instructions here: https://github.com/tensorflow/probability." ) diff --git a/src/transformers/models/transfo_xl/modeling_transfo_xl.py b/src/transformers/models/transfo_xl/modeling_transfo_xl.py index 59c532650eb..2bb7d3b9123 100644 --- a/src/transformers/models/transfo_xl/modeling_transfo_xl.py +++ b/src/transformers/models/transfo_xl/modeling_transfo_xl.py @@ -1012,7 +1012,7 @@ class TransfoXLLMHeadModel(TransfoXLPreTrainedModel): if not self.trainer_compatible: warnings.warn( - "The output of TransfoXL will be updated in v5 to support a single loss as first argument. In order" + "The output of TransfoXL will be updated in v5 to support a single loss as first argument. In order " "to use that updated output, please specify `trainer_compatible=True` as your configuration" " attribute.", DeprecationWarning, diff --git a/src/transformers/models/umt5/configuration_umt5.py b/src/transformers/models/umt5/configuration_umt5.py index 4c3b279230f..980686da6e7 100644 --- a/src/transformers/models/umt5/configuration_umt5.py +++ b/src/transformers/models/umt5/configuration_umt5.py @@ -134,7 +134,7 @@ class UMT5Config(PretrainedConfig): if len(act_info) > 1 and act_info[0] != "gated" or len(act_info) > 2: raise ValueError( - f"`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer." + f"`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer. " "Please make sure `feed_forward_proj` is of the format `gated-{ACT_FN}` or `{ACT_FN}`, e.g. " "'gated-gelu' or 'relu'" ) diff --git a/src/transformers/models/umt5/modeling_umt5.py b/src/transformers/models/umt5/modeling_umt5.py index bd35111be16..ffafd158114 100644 --- a/src/transformers/models/umt5/modeling_umt5.py +++ b/src/transformers/models/umt5/modeling_umt5.py @@ -566,7 +566,7 @@ class UMT5PreTrainedModel(PreTrainedModel): if decoder_start_token_id is None: raise ValueError( - "self.model.config.decoder_start_token_id has to be defined. In UMT5 it is usually set to the pad_token_id." + "self.model.config.decoder_start_token_id has to be defined. In UMT5 it is usually set to the pad_token_id. " "See UMT5 docs for more information." ) diff --git a/src/transformers/models/unispeech/modeling_unispeech.py b/src/transformers/models/unispeech/modeling_unispeech.py index 4c6a1ec13da..a72f56fd2f0 100755 --- a/src/transformers/models/unispeech/modeling_unispeech.py +++ b/src/transformers/models/unispeech/modeling_unispeech.py @@ -1256,7 +1256,7 @@ class UniSpeechForPreTraining(UniSpeechPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1427,7 +1427,7 @@ class UniSpeechForCTC(UniSpeechPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1560,7 +1560,7 @@ class UniSpeechForSequenceClassification(UniSpeechPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) diff --git a/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py b/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py index 73906c69120..50b9093104a 100755 --- a/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py +++ b/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py @@ -1276,7 +1276,7 @@ class UniSpeechSatForPreTraining(UniSpeechSatPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1434,7 +1434,7 @@ class UniSpeechSatForCTC(UniSpeechSatPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1567,7 +1567,7 @@ class UniSpeechSatForSequenceClassification(UniSpeechSatPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1690,7 +1690,7 @@ class UniSpeechSatForAudioFrameClassification(UniSpeechSatPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1857,7 +1857,7 @@ class UniSpeechSatForXVector(UniSpeechSatPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) diff --git a/src/transformers/models/vision_encoder_decoder/modeling_tf_vision_encoder_decoder.py b/src/transformers/models/vision_encoder_decoder/modeling_tf_vision_encoder_decoder.py index 9667c529b56..a0fae071a1b 100644 --- a/src/transformers/models/vision_encoder_decoder/modeling_tf_vision_encoder_decoder.py +++ b/src/transformers/models/vision_encoder_decoder/modeling_tf_vision_encoder_decoder.py @@ -709,6 +709,6 @@ class TFVisionEncoderDecoderModel(TFPreTrainedModel, TFCausalLanguageModelingLos def resize_token_embeddings(self, *args, **kwargs): raise NotImplementedError( - "Resizing the embedding layers via the TFVisionEncoderDecoderModel directly is not supported." + "Resizing the embedding layers via the TFVisionEncoderDecoderModel directly is not supported. " "Please use the respective methods of the wrapped objects (model.decoder.resize_token_embeddings(...))" ) diff --git a/src/transformers/models/vit/modeling_vit.py b/src/transformers/models/vit/modeling_vit.py index 461c7285f23..8fdacdddf04 100644 --- a/src/transformers/models/vit/modeling_vit.py +++ b/src/transformers/models/vit/modeling_vit.py @@ -698,7 +698,7 @@ class ViTForMaskedImageModeling(ViTPreTrainedModel): if bool_masked_pos is not None and (self.config.patch_size != self.config.encoder_stride): raise ValueError( "When `bool_masked_pos` is provided, `patch_size` must be equal to `encoder_stride` to ensure that " - "the reconstructed image has the same dimensions as the input." + "the reconstructed image has the same dimensions as the input. " f"Got `patch_size` = {self.config.patch_size} and `encoder_stride` = {self.config.encoder_stride}." ) diff --git a/src/transformers/models/wav2vec2/modeling_tf_wav2vec2.py b/src/transformers/models/wav2vec2/modeling_tf_wav2vec2.py index c1511e2a88e..8cd02dd8d12 100644 --- a/src/transformers/models/wav2vec2/modeling_tf_wav2vec2.py +++ b/src/transformers/models/wav2vec2/modeling_tf_wav2vec2.py @@ -1438,7 +1438,7 @@ class TFWav2Vec2ForCTC(TFWav2Vec2PreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1593,7 +1593,7 @@ class TFWav2Vec2ForSequenceClassification(TFWav2Vec2PreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) diff --git a/src/transformers/models/wav2vec2/modeling_wav2vec2.py b/src/transformers/models/wav2vec2/modeling_wav2vec2.py index af74533ad06..a495cbcf45f 100755 --- a/src/transformers/models/wav2vec2/modeling_wav2vec2.py +++ b/src/transformers/models/wav2vec2/modeling_wav2vec2.py @@ -1480,7 +1480,7 @@ class Wav2Vec2Model(Wav2Vec2PreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1627,7 +1627,7 @@ class Wav2Vec2ForPreTraining(Wav2Vec2PreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1923,7 +1923,7 @@ class Wav2Vec2ForCTC(Wav2Vec2PreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -2055,7 +2055,7 @@ class Wav2Vec2ForSequenceClassification(Wav2Vec2PreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -2176,7 +2176,7 @@ class Wav2Vec2ForAudioFrameClassification(Wav2Vec2PreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -2340,7 +2340,7 @@ class Wav2Vec2ForXVector(Wav2Vec2PreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) diff --git a/src/transformers/models/wavlm/modeling_wavlm.py b/src/transformers/models/wavlm/modeling_wavlm.py index 9cf67a458b4..5013837cbdc 100755 --- a/src/transformers/models/wavlm/modeling_wavlm.py +++ b/src/transformers/models/wavlm/modeling_wavlm.py @@ -1146,7 +1146,7 @@ class WavLMModel(WavLMPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1322,7 +1322,7 @@ class WavLMForCTC(WavLMPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1455,7 +1455,7 @@ class WavLMForSequenceClassification(WavLMPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1578,7 +1578,7 @@ class WavLMForAudioFrameClassification(WavLMPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) @@ -1745,7 +1745,7 @@ class WavLMForXVector(WavLMPreTrainedModel): not be updated during training. """ warnings.warn( - "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5." + "The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. " "Please use the equivalent `freeze_feature_encoder` method instead.", FutureWarning, ) diff --git a/src/transformers/models/whisper/modeling_tf_whisper.py b/src/transformers/models/whisper/modeling_tf_whisper.py index 1dfe413da2a..67897580761 100644 --- a/src/transformers/models/whisper/modeling_tf_whisper.py +++ b/src/transformers/models/whisper/modeling_tf_whisper.py @@ -1452,8 +1452,8 @@ class TFWhisperForConditionalGeneration(TFWhisperPreTrainedModel, TFCausalLangua if return_timestamps is not None: if not hasattr(generation_config, "no_timestamps_token_id"): raise ValueError( - "You are trying to return timestamps, but the generation config is not properly set." - "Make sure to initialize the generation config with the correct attributes that are needed such as `no_timestamps_token_id`." + "You are trying to return timestamps, but the generation config is not properly set. " + "Make sure to initialize the generation config with the correct attributes that are needed such as `no_timestamps_token_id`. " "For more details on how to generate the approtiate config, refer to https://github.com/huggingface/transformers/issues/21878#issuecomment-1451902363" ) diff --git a/src/transformers/models/whisper/modeling_whisper.py b/src/transformers/models/whisper/modeling_whisper.py index de1565fa761..8962324471c 100644 --- a/src/transformers/models/whisper/modeling_whisper.py +++ b/src/transformers/models/whisper/modeling_whisper.py @@ -1652,8 +1652,8 @@ class WhisperForConditionalGeneration(WhisperPreTrainedModel): if return_timestamps is not None: if not hasattr(generation_config, "no_timestamps_token_id"): raise ValueError( - "You are trying to return timestamps, but the generation config is not properly set." - "Make sure to initialize the generation config with the correct attributes that are needed such as `no_timestamps_token_id`." + "You are trying to return timestamps, but the generation config is not properly set. " + "Make sure to initialize the generation config with the correct attributes that are needed such as `no_timestamps_token_id`. " "For more details on how to generate the approtiate config, refer to https://github.com/huggingface/transformers/issues/21878#issuecomment-1451902363" ) @@ -1664,7 +1664,7 @@ class WhisperForConditionalGeneration(WhisperPreTrainedModel): if language is not None: if not hasattr(generation_config, "lang_to_id"): raise ValueError( - "The generation config is outdated and is thus not compatible with the `language` argument" + "The generation config is outdated and is thus not compatible with the `language` argument " "to `generate`. Either set the language using the `forced_decoder_ids` in the model config, " "or update the generation config as per the instructions https://github.com/huggingface/transformers/issues/25084#issuecomment-1664398224" ) @@ -1673,7 +1673,7 @@ class WhisperForConditionalGeneration(WhisperPreTrainedModel): if task is not None: if not hasattr(generation_config, "task_to_id"): raise ValueError( - "The generation config is outdated and is thus not compatible with the `task` argument" + "The generation config is outdated and is thus not compatible with the `task` argument " "to `generate`. Either set the task using the `forced_decoder_ids` in the model config, " "or update the generation config as per the instructions https://github.com/huggingface/transformers/issues/25084#issuecomment-1664398224" ) diff --git a/src/transformers/models/yolos/image_processing_yolos.py b/src/transformers/models/yolos/image_processing_yolos.py index c51f5add304..317eda9ce83 100644 --- a/src/transformers/models/yolos/image_processing_yolos.py +++ b/src/transformers/models/yolos/image_processing_yolos.py @@ -1137,7 +1137,7 @@ class YolosImageProcessor(BaseImageProcessor): if annotations is not None: if format == AnnotionFormat.COCO_DETECTION and not valid_coco_detection_annotations(annotations): raise ValueError( - "Invalid COCO detection annotations. Annotations must a dict (single image) of list of dicts" + "Invalid COCO detection annotations. Annotations must a dict (single image) of list of dicts " "(batch of images) with the following keys: `image_id` and `annotations`, with the latter " "being a list of annotations in the COCO format." ) diff --git a/src/transformers/pipelines/__init__.py b/src/transformers/pipelines/__init__.py index ae6d20265a0..5b32c74c06f 100755 --- a/src/transformers/pipelines/__init__.py +++ b/src/transformers/pipelines/__init__.py @@ -766,7 +766,7 @@ def pipeline( if task is None and model is not None: if not isinstance(model, str): raise RuntimeError( - "Inferring the task automatically requires to check the hub with a model_id defined as a `str`." + "Inferring the task automatically requires to check the hub with a model_id defined as a `str`. " f"{model} is not a valid model_id." ) task = get_task(model, use_auth_token) diff --git a/src/transformers/pipelines/automatic_speech_recognition.py b/src/transformers/pipelines/automatic_speech_recognition.py index cd053660ad5..b464bfb4092 100644 --- a/src/transformers/pipelines/automatic_speech_recognition.py +++ b/src/transformers/pipelines/automatic_speech_recognition.py @@ -403,7 +403,7 @@ class AutomaticSpeechRecognitionPipeline(ChunkPipeline): raise ValueError("CTC with LM can only predict word level timestamps, set `return_timestamps='word'`") if self.type == "ctc" and return_timestamps not in ["char", "word"]: raise ValueError( - "CTC can either predict character level timestamps, or word level timestamps." + "CTC can either predict character level timestamps, or word level timestamps. " "Set `return_timestamps='char'` or `return_timestamps='word'` as required." ) if self.type == "seq2seq_whisper" and return_timestamps == "char": diff --git a/src/transformers/tools/image_segmentation.py b/src/transformers/tools/image_segmentation.py index b6cbf3eb3f7..ce2615d8bfd 100644 --- a/src/transformers/tools/image_segmentation.py +++ b/src/transformers/tools/image_segmentation.py @@ -28,7 +28,7 @@ if is_vision_available(): class ImageSegmentationTool(PipelineTool): description = ( - "This is a tool that creates a segmentation mask of an image according to a label. It cannot create an image." + "This is a tool that creates a segmentation mask of an image according to a label. It cannot create an image. " "It takes two arguments named `image` which should be the original image, and `label` which should be a text " "describing the elements what should be identified in the segmentation mask. The tool returns the mask." ) diff --git a/src/transformers/trainer.py b/src/transformers/trainer.py index 9fce06968ed..77bac43707a 100755 --- a/src/transformers/trainer.py +++ b/src/transformers/trainer.py @@ -508,7 +508,7 @@ class Trainer: self.optimizer is not None or self.lr_scheduler is not None ): raise RuntimeError( - "Passing `optimizers` is not allowed if Deepspeed or PyTorch FSDP is enabled." + "Passing `optimizers` is not allowed if Deepspeed or PyTorch FSDP is enabled. " "You should subclass `Trainer` and override the `create_optimizer_and_scheduler` method." ) default_callbacks = DEFAULT_CALLBACKS + get_reporting_integration_callbacks(self.args.report_to) @@ -563,8 +563,8 @@ class Trainer: # When there's mismatch between SMP config and trainer argument, use SMP config as truth if args.fp16 != smp.state.cfg.fp16: logger.warning( - f"FP16 provided in SM_HP_MP_PARAMETERS is {smp.state.cfg.fp16}," - f"but FP16 provided in trainer argument is {args.fp16}," + f"FP16 provided in SM_HP_MP_PARAMETERS is {smp.state.cfg.fp16}, " + f"but FP16 provided in trainer argument is {args.fp16}, " f"setting to {smp.state.cfg.fp16}" ) args.fp16 = smp.state.cfg.fp16 diff --git a/src/transformers/training_args.py b/src/transformers/training_args.py index 96cb467bcbe..428db905e73 100644 --- a/src/transformers/training_args.py +++ b/src/transformers/training_args.py @@ -756,7 +756,7 @@ class TrainingArguments: default=500, metadata={ "help": ( - "Log every X updates steps. Should be an integer or a float in range `[0,1)`." + "Log every X updates steps. Should be an integer or a float in range `[0,1)`. " "If smaller than 1, will be interpreted as ratio of total training steps." ) }, @@ -770,7 +770,7 @@ class TrainingArguments: default=500, metadata={ "help": ( - "Save checkpoint every X updates steps. Should be an integer or a float in range `[0,1)`." + "Save checkpoint every X updates steps. Should be an integer or a float in range `[0,1)`. " "If smaller than 1, will be interpreted as ratio of total training steps." ) }, @@ -923,7 +923,7 @@ class TrainingArguments: default=None, metadata={ "help": ( - "Run an evaluation every X steps. Should be an integer or a float in range `[0,1)`." + "Run an evaluation every X steps. Should be an integer or a float in range `[0,1)`. " "If smaller than 1, will be interpreted as ratio of total training steps." ) }, @@ -1006,7 +1006,7 @@ class TrainingArguments: default=None, metadata={ "help": ( - "Config to be used with FSDP (Pytorch Fully Sharded Data Parallel). The value is either a" + "Config to be used with FSDP (Pytorch Fully Sharded Data Parallel). The value is either a " "fsdp json config file (e.g., `fsdp_config.json`) or an already loaded json file as `dict`." ) }, @@ -1207,7 +1207,7 @@ class TrainingArguments: dispatch_batches: Optional[bool] = field( default=None, metadata={ - "help": "Whether to dispatch batches across devices in distributed training. If set to `True`, the dataloader prepared by the Accelerator is only iterated through on the main process" + "help": "Whether to dispatch batches across devices in distributed training. If set to `True`, the dataloader prepared by the Accelerator is only iterated through on the main process " "and then the batches are split and broadcast to each process. Will default to `True` for `DataLoader` whose" "underlying dataset is an `IterableDataset`, `False` otherwise." }, @@ -1297,7 +1297,7 @@ class TrainingArguments: if not (self.eval_steps < 1 and self.save_steps < 1): raise ValueError( "--load_best_model_at_end requires the saving steps to be a multiple of the evaluation " - "steps, which cannot get guaranteed when mixing ratio and absolute steps for save_steps" + "steps, which cannot get guaranteed when mixing ratio and absolute steps for save_steps " f"{self.save_steps} and eval_steps {self.eval_steps}." ) # Work around floating point precision issues @@ -1807,7 +1807,7 @@ class TrainingArguments: elif self.distributed_state.distributed_type == DistributedType.NO: if self.use_mps_device: warnings.warn( - "`use_mps_device` is deprecated and will be removed in version 5.0 of 🤗 Transformers." + "`use_mps_device` is deprecated and will be removed in version 5.0 of 🤗 Transformers. " "`mps` device will be used by default if available similar to the way `cuda` device is used." "Therefore, no action from user is required. " ) diff --git a/src/transformers/utils/doc.py b/src/transformers/utils/doc.py index 17aeadcfdf9..ac35542f7c3 100644 --- a/src/transformers/utils/doc.py +++ b/src/transformers/utils/doc.py @@ -124,7 +124,7 @@ def _prepare_output_docstrings(output_type, config_class, min_indent=None): params_docstring = _convert_output_args_doc(params_docstring) else: raise ValueError( - f"No `Args` or `Parameters` section is found in the docstring of `{output_type.__name__}`. Make sure it has" + f"No `Args` or `Parameters` section is found in the docstring of `{output_type.__name__}`. Make sure it has " "docstring and contain either `Args` or `Parameters`." ) diff --git a/templates/adding_a_new_example_script/{{cookiecutter.directory_name}}/run_{{cookiecutter.example_shortcut}}.py b/templates/adding_a_new_example_script/{{cookiecutter.directory_name}}/run_{{cookiecutter.example_shortcut}}.py index c49eded5807..e447246da2c 100755 --- a/templates/adding_a_new_example_script/{{cookiecutter.directory_name}}/run_{{cookiecutter.example_shortcut}}.py +++ b/templates/adding_a_new_example_script/{{cookiecutter.directory_name}}/run_{{cookiecutter.example_shortcut}}.py @@ -67,7 +67,7 @@ class ModelArguments: model_name_or_path: Optional[str] = field( default=None, metadata={ - "help": "The model checkpoint for weights initialization." + "help": "The model checkpoint for weights initialization. " "Don't set if you want to train a model from scratch." }, ) @@ -128,8 +128,8 @@ class ModelArguments: default=False, metadata={ "help": ( - "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option" - "should only be set to `True` for repositories you trust and in which you have read the code, as it will" + "Whether or not to allow for custom models defined on the Hub in their own modeling files. This option " + "should only be set to `True` for repositories you trust and in which you have read the code, as it will " "execute code present on the Hub on your local machine." ) }, @@ -325,7 +325,7 @@ def main(): tokenizer = AutoTokenizer.from_pretrained(model_args.model_name_or_path, **tokenizer_kwargs) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) @@ -756,7 +756,7 @@ def main(): tokenizer = AutoTokenizer.from_pretrained(model_args.model_name_or_path, use_fast=not args.use_slow_tokenizer) else: raise ValueError( - "You are instantiating a new tokenizer from scratch. This is not supported by this script." + "You are instantiating a new tokenizer from scratch. This is not supported by this script. " "You can do it from another script, save it, and load it from here, using --tokenizer_name." ) diff --git a/tests/pipelines/test_pipelines_automatic_speech_recognition.py b/tests/pipelines/test_pipelines_automatic_speech_recognition.py index d989db3ef2e..50bce7785d6 100644 --- a/tests/pipelines/test_pipelines_automatic_speech_recognition.py +++ b/tests/pipelines/test_pipelines_automatic_speech_recognition.py @@ -1172,7 +1172,7 @@ class AutomaticSpeechRecognitionPipelineTests(unittest.TestCase): # CTC models must specify return_timestamps type - cannot set `return_timestamps=True` blindly with self.assertRaisesRegex( ValueError, - "^CTC can either predict character level timestamps, or word level timestamps." + "^CTC can either predict character level timestamps, or word level timestamps. " "Set `return_timestamps='char'` or `return_timestamps='word'` as required.$", ): _ = speech_recognizer(audio, return_timestamps=True) diff --git a/tests/sagemaker/scripts/pytorch/run_glue_model_parallelism.py b/tests/sagemaker/scripts/pytorch/run_glue_model_parallelism.py index ecbe714a16b..32e28e46971 100644 --- a/tests/sagemaker/scripts/pytorch/run_glue_model_parallelism.py +++ b/tests/sagemaker/scripts/pytorch/run_glue_model_parallelism.py @@ -375,7 +375,7 @@ def main(): if data_args.max_seq_length > tokenizer.model_max_length: logger.warning( - f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the " f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." ) max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) diff --git a/utils/create_dummy_models.py b/utils/create_dummy_models.py index 87f3326504f..343a6602003 100644 --- a/utils/create_dummy_models.py +++ b/utils/create_dummy_models.py @@ -1509,7 +1509,7 @@ if __name__ == "__main__": "--models_to_skip", type=list_str, help=( - "Comma-separated list of model class names(s) from which the tiny models won't be created.\nThis is usually" + "Comma-separated list of model class names(s) from which the tiny models won't be created.\nThis is usually " "the list of model classes that have their tiny versions already uploaded to the Hub." ), )