Skip to content

Commit adfb6e6

Browse files
authored
Merge pull request aws#36 from awslabs/mvs-fix-flushing
fix flush bug
2 parents 51aaffa + dad0185 commit adfb6e6

File tree

1 file changed

+7
-3
lines changed
  • sagemaker-python-sdk/tensorflow_resnet_cifar10_with_tensorboard

1 file changed

+7
-3
lines changed

sagemaker-python-sdk/tensorflow_resnet_cifar10_with_tensorboard/utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import sys
33
import tarfile
44
from six.moves import urllib
5+
from ipywidgets import FloatProgress
6+
from IPython.display import display
57

68
DATA_URL = 'https://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz'
79

@@ -19,11 +21,13 @@ def cifar10_download(data_dir='/tmp/cifar10_data', print_progress=True):
1921
filepath = os.path.join(data_dir, filename)
2022

2123
if not os.path.exists(filepath):
24+
f = FloatProgress(min=0, max=100)
25+
display(f)
26+
sys.stdout.write('\r>> Downloading %s ' % (filename))
27+
2228
def _progress(count, block_size, total_size):
2329
if print_progress:
24-
sys.stdout.write('\r>> Downloading %s %.1f%%' % (
25-
filename, 100.0 * count * block_size / total_size))
26-
sys.stdout.flush()
30+
f.value = 100.0 * count * block_size / total_size
2731

2832
filepath, _ = urllib.request.urlretrieve(DATA_URL, filepath, _progress)
2933
print()

0 commit comments

Comments
 (0)