mlflow/mlflow · error · MlflowException
When `task` is specified as `{inference_task}`, the signatur
Error message
When `task` is specified as `{inference_task}`, the signature would be set by MLflow. Please do not set the signature. What it means
Error "When `task` is specified as `{inference_task}`, the signature would be set by MLflow. Please do not set the signature." thrown in mlflow/mlflow.
Source
Thrown at mlflow/transformers/llm_inference_utils.py:77
}
_LLM_INFERENCE_TASK_TO_DATA_FIELD = {
_LLM_INFERENCE_TASK_CHAT: "messages",
_LLM_INFERENCE_TASK_COMPLETIONS: "prompt",
}
def infer_signature_from_llm_inference_task(
inference_task: str, signature: ModelSignature | None = None
) -> ModelSignature:
"""
Infers the signature according to the MLflow inference task.
Raises exception if a signature is given.
"""
inferred_signature = _SIGNATURE_FOR_LLM_INFERENCE_TASK[inference_task]
if signature is not None and signature != inferred_signature:
raise MlflowException(
f"When `task` is specified as `{inference_task}`, the signature would "
"be set by MLflow. Please do not set the signature."
)
return inferred_signature
def convert_messages_to_prompt(messages: list[dict[str, Any]], tokenizer) -> str:
"""For the Chat inference task, apply chat template to messages to create prompt.
Args:
messages: List of message e.g. [{"role": user, "content": xxx}, ...]
tokenizer: The tokenizer object used for inference.
Returns:
The prompt string contains the messages.
"""
if not (isinstance(messages, list) and all(isinstance(msg, dict) for msg in messages)):
raise MlflowException(View on GitHub (pinned to 6a27f2decc)
When it happens
Trigger: Thrown at mlflow/transformers/llm_inference_utils.py:77 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29).
Data as JSON: /api/errors/2b54cd52bf915d8b.
Report an issue: GitHub.