Skip to content
This repository was archived by the owner on Jun 29, 2019. It is now read-only.
This repository was archived by the owner on Jun 29, 2019. It is now read-only.

Download Bars do not work  #32

Description

fancy printouts from things like keras' model downloader do not work.

from keras.applications.resnet50 import ResNet50
ResNet50(include_top=False)

Error:

  File "/var/azureml-app/driver_jabil.py", line 75, in init
    Predictor().load_model(model_path="lightgbm_classifier.model")
  File "/var/azureml-app/driver_jabil.py", line 47, in load_model
    self.model = ResNet50(include_top=False)
  File "/opt/conda/lib/python3.5/site-packages/keras/applications/resnet50.py", line 263, in ResNet50
    md5_hash='a268eb855778b3df3c7506639542a6af')
  File "/opt/conda/lib/python3.5/site-packages/keras/utils/data_utils.py", line 220, in get_file
    urlretrieve(origin, fpath, dl_progress)
  File "/opt/conda/lib/python3.5/urllib/request.py", line 224, in urlretrieve
    reporthook(blocknum, bs, size)
  File "/opt/conda/lib/python3.5/site-packages/keras/utils/data_utils.py", line 215, in dl_progress
    ProgressTracker.progbar.update(count * block_size)
  File "/opt/conda/lib/python3.5/site-packages/keras/utils/generic_utils.py", line 345, in update
    sys.stdout.flush()
  File "/var/azureml-app/print_hook.py", line 79, in __getattr__
    return self._original_fd.__getattr__(name)
AttributeError: '_io.TextIOWrapper' object has no attribute '__getattr__'

Workaround:

def blockPrint():
    sys.stdout = open(os.devnull, 'w')

def enablePrint():
    sys.stdout = sys.__stdout__

blockPrint()
ResNet50(include_top=False)
enablePrint()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions