Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Fairseq
Commits
2b482f63
"cacheflow/git@developer.sourcefind.cn:norm/vllm.git" did not exist on "311490a720951f322977d811eacea685a623b5a1"
Commit
2b482f63
authored
Oct 14, 2017
by
Myle Ott
Browse files
Fix --no-progress-bar option in generate.py (#115)
parent
9c5fa5c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
fairseq/progress_bar.py
fairseq/progress_bar.py
+3
-2
No files found.
fairseq/progress_bar.py
View file @
2b482f63
...
@@ -31,7 +31,7 @@ class progress_bar(tqdm):
...
@@ -31,7 +31,7 @@ class progress_bar(tqdm):
class
simple_progress_bar
(
object
):
class
simple_progress_bar
(
object
):
"""A minimal replacement for tqdm in non-TTY environments."""
"""A minimal replacement for tqdm in non-TTY environments."""
def
__init__
(
self
,
print_interval
,
iterable
,
desc
,
*
_args
,
**
_kwargs
):
def
__init__
(
self
,
print_interval
,
iterable
,
desc
=
None
,
*
_args
,
**
_kwargs
):
super
().
__init__
()
super
().
__init__
()
self
.
print_interval
=
print_interval
self
.
print_interval
=
print_interval
self
.
iterable
=
iterable
self
.
iterable
=
iterable
...
@@ -48,7 +48,8 @@ class simple_progress_bar(object):
...
@@ -48,7 +48,8 @@ class simple_progress_bar(object):
for
i
,
obj
in
enumerate
(
self
.
iterable
):
for
i
,
obj
in
enumerate
(
self
.
iterable
):
yield
obj
yield
obj
if
i
>
0
and
i
%
self
.
print_interval
==
0
:
if
i
>
0
and
i
%
self
.
print_interval
==
0
:
msg
=
'{}: {:5d} / {:d} {}
\n
'
.
format
(
self
.
desc
,
i
,
size
,
self
.
postfix
)
desc
=
''
if
self
.
desc
is
None
else
'{}: '
.
format
(
self
.
desc
)
msg
=
'{}{:5d} / {:d} {}
\n
'
.
format
(
desc
,
i
,
size
,
self
.
postfix
)
sys
.
stdout
.
write
(
msg
)
sys
.
stdout
.
write
(
msg
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
...
...
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