Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
4ee1053d
Unverified
Commit
4ee1053d
authored
Sep 10, 2020
by
Stas Bekman
Committed by
GitHub
Sep 10, 2020
Browse files
add -y to bypass prompt for transformers-cli upload (#7035)
parent
76818cc4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
docs/source/model_sharing.rst
docs/source/model_sharing.rst
+7
-0
src/transformers/commands/user.py
src/transformers/commands/user.py
+6
-4
No files found.
docs/source/model_sharing.rst
View file @
4ee1053d
...
@@ -136,6 +136,13 @@ Then log in using the same credentials as on huggingface.co. To upload your mode
...
@@ -136,6 +136,13 @@ Then log in using the same credentials as on huggingface.co. To upload your mode
This
will
upload
the
folder
containing
the
weights
,
tokenizer
and
configuration
we
prepared
in
the
previous
section
.
This
will
upload
the
folder
containing
the
weights
,
tokenizer
and
configuration
we
prepared
in
the
previous
section
.
By
default
you
will
be
prompted
to
confirm
that
you
want
these
files
to
be
uploaded
.
If
you
are
uploading
multiple
models
and
need
to
script
that
process
,
you
can
add
`-
y
`
to
bypass
the
prompt
.
For
example
:
::
transformers
-
cli
upload
-
y
path
/
to
/
awesome
-
name
-
you
-
picked
/
If
you
want
to
upload
a
single
file
(
a
new
version
of
your
model
,
or
the
other
framework
checkpoint
you
want
to
add
),
If
you
want
to
upload
a
single
file
(
a
new
version
of
your
model
,
or
the
other
framework
checkpoint
you
want
to
add
),
just
type
:
just
type
:
...
...
src/transformers/commands/user.py
View file @
4ee1053d
...
@@ -40,6 +40,7 @@ class UserCommands(BaseTransformersCLICommand):
...
@@ -40,6 +40,7 @@ class UserCommands(BaseTransformersCLICommand):
upload_parser
.
add_argument
(
upload_parser
.
add_argument
(
"--filename"
,
type
=
str
,
default
=
None
,
help
=
"Optional: override individual object filename on S3."
"--filename"
,
type
=
str
,
default
=
None
,
help
=
"Optional: override individual object filename on S3."
)
)
upload_parser
.
add_argument
(
"-y"
,
"--yes"
,
action
=
"store_true"
,
help
=
"Optional: answer Yes to the prompt"
)
upload_parser
.
set_defaults
(
func
=
lambda
args
:
UploadCommand
(
args
))
upload_parser
.
set_defaults
(
func
=
lambda
args
:
UploadCommand
(
args
))
...
@@ -221,10 +222,11 @@ class UploadCommand(BaseUserCommand):
...
@@ -221,10 +222,11 @@ class UploadCommand(BaseUserCommand):
)
)
)
)
choice
=
input
(
"Proceed? [Y/n] "
).
lower
()
if
not
self
.
args
.
yes
:
if
not
(
choice
==
""
or
choice
==
"y"
or
choice
==
"yes"
):
choice
=
input
(
"Proceed? [Y/n] "
).
lower
()
print
(
"Abort"
)
if
not
(
choice
==
""
or
choice
==
"y"
or
choice
==
"yes"
):
exit
()
print
(
"Abort"
)
exit
()
print
(
ANSI
.
bold
(
"Uploading... This might take a while if files are large"
))
print
(
ANSI
.
bold
(
"Uploading... This might take a while if files are large"
))
for
filepath
,
filename
in
files
:
for
filepath
,
filename
in
files
:
try
:
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment