Skip to content

Commit 3f48dea

Browse files
committed
remove unused _process_signature and PYTORCH_DATA_SUBPATH
1 parent fe88f59 commit 3f48dea

2 files changed

Lines changed: 2 additions & 36 deletions

File tree

datamint/mlflow/flavors/datamint_flavor.py

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,9 @@
1919
logger = logging.getLogger(__name__)
2020

2121
FLAVOR_NAME = 'datamint'
22-
PYTORCH_DATA_SUBPATH = "pytorch_data"
23-
24-
25-
def _process_signature(signature: ModelSignature | None,
26-
python_model: BaseDatamintModel) -> ModelSignature:
27-
from mlflow.types import ParamSchema, ParamSpec
28-
from mlflow.models.signature import _infer_signature_from_type_hints
29-
30-
# Define inference parameters schema for BaseDatamintModel.predict()
31-
# - mode (str): prediction mode to dispatch to (e.g. 'default', 'image', 'slice', etc.)
32-
# - log_predictions (bool): whether to upload predictions as annotations to Datamint
33-
# - model_name (str | None): name of the model used for tagging uploaded predictions
34-
params_schema = ParamSchema([
35-
ParamSpec("mode", "string", "default"),
36-
ParamSpec("log_predictions", "boolean", False),
37-
ParamSpec("model_name", "string", None),
38-
])
39-
40-
if signature is None:
41-
signature = _infer_signature_from_type_hints(
42-
python_model=python_model,
43-
context=None,
44-
type_hints=python_model.predict_type_hints,
45-
input_example=None,
46-
)
47-
assert signature is not None
48-
49-
# Merge existing params with our new params, ensuring no duplicates
50-
existing_params: list[ParamSpec] = signature.params.params if signature.params else []
51-
existing_param_names = {param.name for param in existing_params}
52-
new_params = [param for param in params_schema.params if param.name not in existing_param_names]
53-
signature.params = ParamSchema(existing_params + new_params)
54-
55-
return signature
5622

5723

58-
def _process_input_example(input_example: ModelInputExample | None) -> tuple[ModelInputExample | None, dict[str, Any]]:
24+
def _process_input_example(input_example: ModelInputExample | None) -> tuple[ModelInputExample, dict[str, Any]]:
5925
datamint_params = {
6026
'mode': 'default',
6127
'model_name': 'undefined_model_name',

datamint/mlflow/flavors/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from dataclasses import dataclass
44
from functools import cached_property
55
import logging
6-
from typing import Any, ClassVar, TypeAlias, cast
6+
from typing import Any, ClassVar, TypeAlias
77

88
from mlflow.environment_variables import MLFLOW_DEFAULT_PREDICTION_DEVICE
99
from mlflow.pyfunc import PyFuncModel

0 commit comments

Comments
 (0)