Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a unified and controllable logging interface for library outputs #224

Open
huzecong opened this issue Oct 7, 2019 · 1 comment
Open
Labels
enhancement New feature or request priority: low Low priority, can be addressed later

Comments

@huzecong
Copy link
Collaborator

huzecong commented Oct 7, 2019

In a few places Texar-PyTorch would print out information (e.g., "download complete", "pre-trained weights loaded") using the Python builtin print function. The behavior might not be desired and is not controllable (cannot be suppressed).

We could use the logging builtin library for this purpose. A couple of points to make sure are:

  • Provide a Texar interface to set logging levels, so even if we switch libraries old code would still work.
  • If users also use the logging library, their settings should not overwrite ours, and vice versa.

Certain outputs should be converted to exception messages, such as the following two examples:

else:
print("Name error", name)
raise Exception

except ImportError:
print("Loading TensorFlow models in PyTorch requires installing "
"TensorFlow. Please see https://www.tensorflow.org/install/ "
"for installation instructions.")
raise

@huzecong huzecong added enhancement New feature or request priority: low Low priority, can be addressed later labels Oct 7, 2019
@huzecong
Copy link
Collaborator Author

huzecong commented Oct 7, 2019

Oh, one problem with using logging would be that it's probably not possible to log download progress in this way, because logging does not support clear lines. Also, there's a bug in the current download progress logging logic, so that small files will show a percentage greater than 100%.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: low Low priority, can be addressed later
Projects
None yet
Development

No branches or pull requests

1 participant