Skip to content

Commit

Permalink
BUG: transformers logs missing (#2530)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengjieLi28 authored Nov 7, 2024
1 parent 8f084b8 commit 85ab86b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 0 additions & 8 deletions xinference/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@
"propagate": False,
}
},
"root": {
"level": "WARN",
"handlers": ["stream_handler"],
},
}

TEST_LOG_FILE_PATH = get_log_file(f"test_{get_timestamp_ms()}")
Expand Down Expand Up @@ -102,10 +98,6 @@
"propagate": False,
}
},
"root": {
"level": "WARN",
"handlers": ["stream_handler", "file_handler"],
},
}


Expand Down
5 changes: 5 additions & 0 deletions xinference/deploy/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
get_log_file,
get_timestamp_ms,
handle_click_args_type,
set_envs,
)

try:
Expand Down Expand Up @@ -106,6 +107,8 @@ def start_local_cluster(
XINFERENCE_LOG_MAX_BYTES,
)
logging.config.dictConfig(dict_config) # type: ignore
# refer to https://huggingface.co/docs/transformers/main_classes/logging
set_envs("TRANSFORMERS_VERBOSITY", log_level.lower())

main(
host=host,
Expand Down Expand Up @@ -280,6 +283,7 @@ def supervisor(
XINFERENCE_LOG_MAX_BYTES,
)
logging.config.dictConfig(dict_config) # type: ignore
set_envs("TRANSFORMERS_VERBOSITY", log_level.lower())

main(
host=host,
Expand Down Expand Up @@ -342,6 +346,7 @@ def worker(
XINFERENCE_LOG_MAX_BYTES,
)
logging.config.dictConfig(dict_config) # type: ignore
set_envs("TRANSFORMERS_VERBOSITY", log_level.lower())

endpoint = get_endpoint(endpoint)

Expand Down
11 changes: 7 additions & 4 deletions xinference/deploy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ def get_config_dict(
"propagate": False,
},
},
"root": {
"level": "WARN",
"handlers": ["stream_handler", "file_handler"],
},
}
return config_dict

Expand Down Expand Up @@ -220,3 +216,10 @@ def handle_click_args_type(arg: str) -> Any:
pass

return arg


def set_envs(key: str, value: str):
"""
Environment variables are set by the parent process and inherited by child processes
"""
os.environ[key] = value

0 comments on commit 85ab86b

Please sign in to comment.