Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions stanza/pipeline/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,9 @@ def __init__(self,
if model_dir is not None and dir == DEFAULT_MODEL_DIR:
self.dir = model_dir

# set global logging level
set_logging_level(logging_level, verbose)
# Only adjust logging if the caller explicitly requested it
if logging_level is not None or verbose is not None:
set_logging_level(logging_level, verbose)

self.download_method = normalize_download_method(download_method)
if (self.download_method is DownloadMethod.DOWNLOAD_RESOURCES or
Expand Down
8 changes: 6 additions & 2 deletions stanza/resources/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,12 @@ def download(
proxies=None,
download_json=True
):
# set global logging level
set_logging_level(logging_level, verbose)
# Only set global logging level if the caller explicitly requested it.
# Previously this was called unconditionally, which meant a simple
# stanza.download('en') would reset the user's logging configuration
# as a side effect. See https://github.com/stanfordnlp/stanza/issues/1418
if logging_level is not None or verbose is not None:
set_logging_level(logging_level, verbose)
# process different pipeline parameters
lang, model_dir, package, processors = process_pipeline_parameters(
lang, model_dir, package, processors
Expand Down
3 changes: 2 additions & 1 deletion stanza/resources/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def install_corenlp(dir=DEFAULT_CORENLP_DIR, url=DEFAULT_CORENLP_URL, logging_le
logging_level: logging level to use during installation
"""
dir = os.path.expanduser(dir)
set_logging_level(logging_level=logging_level, verbose=None)
if logging_level is not None:
set_logging_level(logging_level=logging_level, verbose=None)
if os.path.exists(dir) and len(os.listdir(dir)) > 0:
logger.warn(
f"Directory {dir} already exists. "
Expand Down