diff --git a/engines/python/setup/djl_python/huggingface.py b/engines/python/setup/djl_python/huggingface.py index 0bac03fb9d..a04506213c 100644 --- a/engines/python/setup/djl_python/huggingface.py +++ b/engines/python/setup/djl_python/huggingface.py @@ -491,7 +491,8 @@ def _read_model_config(self, model_config_path: str): except Exception as e: logging.error( f"{model_config_path} does not contain a config.json or adapter_config.json for lora models. " - f"This is required for loading huggingface models") + f"This is required for loading huggingface models", + exc_info=True) raise e diff --git a/engines/python/setup/djl_python/sm_log_filter.py b/engines/python/setup/djl_python/sm_log_filter.py index a26f0aca40..348ec1ec99 100644 --- a/engines/python/setup/djl_python/sm_log_filter.py +++ b/engines/python/setup/djl_python/sm_log_filter.py @@ -46,7 +46,8 @@ def filter(self, record): return False except Exception as exc: logging.warning( - f"Forwarding {str(record)} failed due to {str(exc)}") + f"Forwarding {str(record)} failed due to {str(exc)}", + exc_info=True) return False def count(self, key): diff --git a/engines/python/setup/djl_python/streaming_utils.py b/engines/python/setup/djl_python/streaming_utils.py index b600518ee7..3efc36c386 100644 --- a/engines/python/setup/djl_python/streaming_utils.py +++ b/engines/python/setup/djl_python/streaming_utils.py @@ -87,6 +87,7 @@ def run_generation(model, **kwargs): try: model.generate(**kwargs) except Exception as e: + logging.warning("stream generation failed", exc_info=True) streamer.put_text(str(e)) finally: streamer.end() diff --git a/engines/python/setup/djl_python/utils.py b/engines/python/setup/djl_python/utils.py index 62374c23d4..5cfa756374 100644 --- a/engines/python/setup/djl_python/utils.py +++ b/engines/python/setup/djl_python/utils.py @@ -71,9 +71,15 @@ def parse_input_with_formatter(inputs: Input, adapters_per_item, found_adapter_per_item = _parse_adapters( _inputs, input_map, item, adapter_registry) except Exception as e: # pylint: disable=broad-except - logging.warning(f"Parse input failed: {i}") input_size.append(0) - errors[i] = str(e) + err_msg = "Input Parsing failed. Ensure that the request payload is valid. " + # str(e) for KeyError only yields the name of the key, which isn't useful as a response to the client + if isinstance(e, KeyError): + err_msg += f"Invalid Request Property: {e}" + else: + err_msg += str(e) + errors[i] = err_msg + logging.warning(err_msg, exc_info=True) continue input_data.extend(_inputs)