diff --git a/examples/sktime/flavor.py b/examples/sktime/flavor.py
index 26a0f16045197..bc8704627dc94 100644
--- a/examples/sktime/flavor.py
+++ b/examples/sktime/flavor.py
@@ -218,7 +218,7 @@ def save_model(
message=(
f"Unrecognized serialization format: {serialization_format}. "
"Please specify one of the following supported formats: "
- "{SUPPORTED_SERIALIZATION_FORMATS}."
+ f"{SUPPORTED_SERIALIZATION_FORMATS}."
),
error_code=INVALID_PARAMETER_VALUE,
)
diff --git a/mlflow/gateway/providers/anthropic.py b/mlflow/gateway/providers/anthropic.py
index a742ba06490c3..3507532ec206d 100644
--- a/mlflow/gateway/providers/anthropic.py
+++ b/mlflow/gateway/providers/anthropic.py
@@ -67,7 +67,7 @@ def completions_to_model(cls, payload, config):
if n != 1:
raise HTTPException(
status_code=422,
- detail="'n' must be '1' for the Anthropic provider. Received value: '{n}'.",
+ detail=f"'n' must be '1' for the Anthropic provider. Received value: '{n}'.",
)
payload = rename_payload_keys(payload, key_mapping)
diff --git a/mlflow/gateway/providers/bedrock.py b/mlflow/gateway/providers/bedrock.py
index ed0d1223936ad..f80a30c3bda64 100644
--- a/mlflow/gateway/providers/bedrock.py
+++ b/mlflow/gateway/providers/bedrock.py
@@ -50,7 +50,7 @@ def completions_to_model(cls, payload, config):
if n != 1:
raise HTTPException(
status_code=422,
- detail="'n' must be '1' for AWS Titan models. Received value: '{n}'.",
+ detail=f"'n' must be '1' for AWS Titan models. Received value: '{n}'.",
)
# The range of Titan's temperature is 0-1, but ours is 0-2, so we halve it
diff --git a/mlflow/recipes/cards/pandas_renderer.py b/mlflow/recipes/cards/pandas_renderer.py
index 352a8f78ac3b4..afcb6db7b3756 100644
--- a/mlflow/recipes/cards/pandas_renderer.py
+++ b/mlflow/recipes/cards/pandas_renderer.py
@@ -291,7 +291,7 @@ def construct_facets_html(
protostr = base64.b64encode(proto.SerializeToString()).decode("utf-8")
polyfills_code = get_facets_polyfills()
- html_template = """
+ return f"""
@@ -299,7 +299,6 @@ def construct_facets_html(
""" # noqa: E501
- return html_template.format(protostr=protostr, compare=compare, polyfills_code=polyfills_code)
def get_html(inputs: Union[pd.DataFrame, Iterable[Tuple[str, pd.DataFrame]]]) -> str:
diff --git a/mlflow/tracking/client.py b/mlflow/tracking/client.py
index f6de85de3a488..742def55776ff 100644
--- a/mlflow/tracking/client.py
+++ b/mlflow/tracking/client.py
@@ -3555,7 +3555,7 @@ def print_model_version_info(mv):
)
latest_versions = self.get_latest_versions(name, stages=[stage])
if not latest_versions:
- raise MlflowException("Could not find any model version for {stage} stage")
+ raise MlflowException(f"Could not find any model version for {stage} stage")
version = latest_versions[0].version
self._get_registry_client().delete_model_version_tag(name, version, key)
diff --git a/mlflow/transformers/signature.py b/mlflow/transformers/signature.py
index 002b788e3b1fd..11048484c36bd 100644
--- a/mlflow/transformers/signature.py
+++ b/mlflow/transformers/signature.py
@@ -105,14 +105,14 @@ def infer_or_get_default_signature(
if isinstance(e, MlflowTimeoutError):
msg = (
"Attempted to generate a signature for the saved pipeline but prediction timed "
- "out after {timeout} seconds. Falling back to the default signature for the "
+ f"out after {timeout} seconds. Falling back to the default signature for the "
"pipeline. You can specify a signature manually or increase the timeout "
f"by setting the environment variable {MLFLOW_INPUT_EXAMPLE_INFERENCE_TIMEOUT}"
)
else:
msg = (
"Attempted to generate a signature for the saved pipeline but encountered an "
- "error. Fall back to the default signature for the pipeline type. Error: {e}"
+ f"error. Fall back to the default signature for the pipeline type. Error: {e}"
)
_logger.warning(msg)
diff --git a/mlflow/utils/model_utils.py b/mlflow/utils/model_utils.py
index 79c84605ef46d..eac4dea88f628 100644
--- a/mlflow/utils/model_utils.py
+++ b/mlflow/utils/model_utils.py
@@ -220,12 +220,12 @@ def _validate_onnx_session_options(onnx_session_options):
elif key == "execution_mode" and value.upper() not in ["PARALLEL", "SEQUENTIAL"]:
raise ValueError(
f"Value for key {key} in onnx_session_options should be "
- "'parallel' or 'sequential', not {value}"
+ f"'parallel' or 'sequential', not {value}"
)
elif key == "graph_optimization_level" and value not in [0, 1, 2, 99]:
raise ValueError(
f"Value for key {key} in onnx_session_options should be 0, 1, 2, or 99, "
- "not {value}"
+ f"not {value}"
)
elif key in ["intra_op_num_threads", "intra_op_num_threads"] and value < 0:
raise ValueError(
diff --git a/mlflow/utils/search_utils.py b/mlflow/utils/search_utils.py
index 153d4103cde68..3d4d446e09926 100644
--- a/mlflow/utils/search_utils.py
+++ b/mlflow/utils/search_utils.py
@@ -519,7 +519,7 @@ def is_string_attribute(cls, key_type, key_name, comparator):
if key_type == cls._ATTRIBUTE_IDENTIFIER and key_name not in cls.NUMERIC_ATTRIBUTES:
if comparator not in cls.VALID_STRING_ATTRIBUTE_COMPARATORS:
raise MlflowException(
- "Invalid comparator '{comparator}' not one of "
+ f"Invalid comparator '{comparator}' not one of "
f"'{cls.VALID_STRING_ATTRIBUTE_COMPARATORS}'"
)
return True
@@ -932,7 +932,7 @@ def is_attribute(cls, key_type, comparator):
if key_type == cls._ATTRIBUTE_IDENTIFIER:
if comparator not in cls.VALID_STRING_ATTRIBUTE_COMPARATORS:
raise MlflowException(
- "Invalid comparator '{comparator}' not one of "
+ f"Invalid comparator '{comparator}' not one of "
f"'{cls.VALID_STRING_ATTRIBUTE_COMPARATORS}'"
)
return True
diff --git a/tests/store/tracking/test_file_store.py b/tests/store/tracking/test_file_store.py
index 524684c3b8522..37c7210e852bc 100644
--- a/tests/store/tracking/test_file_store.py
+++ b/tests/store/tracking/test_file_store.py
@@ -2382,7 +2382,7 @@ def test_log_input_multiple_times_does_not_overwrite_tags_or_dataset(store):
overwrite_dataset = Dataset(
name="name",
digest="digest",
- source_type="st{i}",
+ source_type=f"st{i}",
source=f"source{i}",
schema=f"schema{i}",
profile=f"profile{i}",