Commit d8293e84 authored by Julien Chaumond's avatar Julien Chaumond
Browse files

[cli] upload: max number of files at the same time

parent 4d6c93e9
...@@ -9,6 +9,9 @@ from transformers.commands import BaseTransformersCLICommand ...@@ -9,6 +9,9 @@ from transformers.commands import BaseTransformersCLICommand
from transformers.hf_api import HfApi, HfFolder from transformers.hf_api import HfApi, HfFolder
UPLOAD_MAX_FILES = 15
class UserCommands(BaseTransformersCLICommand): class UserCommands(BaseTransformersCLICommand):
@staticmethod @staticmethod
def register_subcommand(parser: ArgumentParser): def register_subcommand(parser: ArgumentParser):
...@@ -180,6 +183,14 @@ class UploadCommand(BaseUserCommand): ...@@ -180,6 +183,14 @@ class UploadCommand(BaseUserCommand):
else: else:
raise ValueError("Not a valid file or directory: {}".format(local_path)) 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: for filepath, filename in files:
print("About to upload file {} to S3 under filename {}".format(ANSI.bold(filepath), ANSI.bold(filename))) print("About to upload file {} to S3 under filename {}".format(ANSI.bold(filepath), ANSI.bold(filename)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment