Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
a6394cd9
Commit
a6394cd9
authored
Sep 22, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tqdm isatty for jupyter notebook
parent
7b232c98
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
tensorpack/utils/utils.py
tensorpack/utils/utils.py
+12
-1
No files found.
tensorpack/utils/utils.py
View file @
a6394cd9
...
@@ -111,10 +111,21 @@ def get_tqdm_kwargs(**kwargs):
...
@@ -111,10 +111,21 @@ def get_tqdm_kwargs(**kwargs):
ascii
=
True
,
ascii
=
True
,
bar_format
=
'{l_bar}{bar}|{n_fmt}/{total_fmt}[{elapsed}<{remaining},{rate_noinv_fmt}]'
bar_format
=
'{l_bar}{bar}|{n_fmt}/{total_fmt}[{elapsed}<{remaining},{rate_noinv_fmt}]'
)
)
f
=
kwargs
.
get
(
'file'
,
sys
.
stderr
)
f
=
kwargs
.
get
(
'file'
,
sys
.
stderr
)
if
f
.
isatty
():
# os.isatty and f.isatty give different result under jupyter notebook.
# We use os.isatty when stdout/stderr is used, so that jupyter notebook will be recognized as tty.
if
f
==
sys
.
stderr
:
isatty
=
os
.
isatty
(
2
)
elif
f
==
sys
.
stdout
:
isatty
=
os
.
isatty
(
1
)
else
:
isatty
=
f
.
isatty
()
if
isatty
:
default
[
'mininterval'
]
=
0.5
default
[
'mininterval'
]
=
0.5
else
:
else
:
# If not a tty, don't refresh progress bar that often
default
[
'mininterval'
]
=
300
default
[
'mininterval'
]
=
300
default
.
update
(
kwargs
)
default
.
update
(
kwargs
)
return
default
return
default
...
...
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