From d8293e84f3672345f584ba77a790d8f0588cad6a Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Fri, 27 Dec 2019 23:02:53 -0500 Subject: [PATCH] [cli] upload: max number of files at the same time --- src/transformers/commands/user.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/transformers/commands/user.py b/src/transformers/commands/user.py index 6392cd0d19..84668fcc4f 100644 --- a/src/transformers/commands/user.py +++ b/src/transformers/commands/user.py @@ -9,6 +9,9 @@ from transformers.commands import BaseTransformersCLICommand from transformers.hf_api import HfApi, HfFolder +UPLOAD_MAX_FILES = 15 + + class UserCommands(BaseTransformersCLICommand): @staticmethod def register_subcommand(parser: ArgumentParser): @@ -180,6 +183,14 @@ class UploadCommand(BaseUserCommand): else: raise ValueError("Not a valid file or directory: {}".format(local_path)) + if len(files) > UPLOAD_MAX_FILES: + print( + "About to upload {} files to S3. This is probably wrong. Please filter files before uploading.".format( + ANSI.bold(len(files)) + ) + ) + exit(1) + for filepath, filename in files: print("About to upload file {} to S3 under filename {}".format(ANSI.bold(filepath), ANSI.bold(filename)))