mlrun 1.7.1rc4__py3-none-any.whl → 1.8.0rc8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mlrun might be problematic. Click here for more details.
- mlrun/__init__.py +23 -21
- mlrun/__main__.py +3 -3
- mlrun/alerts/alert.py +148 -14
- mlrun/artifacts/__init__.py +1 -2
- mlrun/artifacts/base.py +46 -12
- mlrun/artifacts/dataset.py +16 -16
- mlrun/artifacts/document.py +334 -0
- mlrun/artifacts/manager.py +15 -13
- mlrun/artifacts/model.py +66 -53
- mlrun/common/constants.py +7 -0
- mlrun/common/formatters/__init__.py +1 -0
- mlrun/common/formatters/feature_set.py +1 -0
- mlrun/common/formatters/function.py +1 -0
- mlrun/{model_monitoring/db/stores/base/__init__.py → common/formatters/model_endpoint.py} +16 -1
- mlrun/common/formatters/pipeline.py +1 -2
- mlrun/common/formatters/project.py +9 -0
- mlrun/common/model_monitoring/__init__.py +0 -5
- mlrun/common/model_monitoring/helpers.py +1 -29
- mlrun/common/runtimes/constants.py +1 -2
- mlrun/common/schemas/__init__.py +6 -2
- mlrun/common/schemas/alert.py +111 -19
- mlrun/common/schemas/api_gateway.py +3 -3
- mlrun/common/schemas/artifact.py +11 -7
- mlrun/common/schemas/auth.py +6 -4
- mlrun/common/schemas/background_task.py +7 -7
- mlrun/common/schemas/client_spec.py +2 -3
- mlrun/common/schemas/clusterization_spec.py +2 -2
- mlrun/common/schemas/common.py +53 -3
- mlrun/common/schemas/constants.py +15 -0
- mlrun/common/schemas/datastore_profile.py +1 -1
- mlrun/common/schemas/feature_store.py +9 -9
- mlrun/common/schemas/frontend_spec.py +4 -4
- mlrun/common/schemas/function.py +10 -10
- mlrun/common/schemas/hub.py +1 -1
- mlrun/common/schemas/k8s.py +3 -3
- mlrun/common/schemas/memory_reports.py +3 -3
- mlrun/common/schemas/model_monitoring/__init__.py +2 -1
- mlrun/common/schemas/model_monitoring/constants.py +66 -14
- mlrun/common/schemas/model_monitoring/grafana.py +1 -1
- mlrun/common/schemas/model_monitoring/model_endpoints.py +91 -147
- mlrun/common/schemas/notification.py +24 -3
- mlrun/common/schemas/object.py +1 -1
- mlrun/common/schemas/pagination.py +4 -4
- mlrun/common/schemas/partition.py +137 -0
- mlrun/common/schemas/pipeline.py +2 -2
- mlrun/common/schemas/project.py +25 -17
- mlrun/common/schemas/runs.py +2 -2
- mlrun/common/schemas/runtime_resource.py +5 -5
- mlrun/common/schemas/schedule.py +1 -1
- mlrun/common/schemas/secret.py +1 -1
- mlrun/common/schemas/tag.py +3 -3
- mlrun/common/schemas/workflow.py +5 -5
- mlrun/config.py +67 -10
- mlrun/data_types/__init__.py +0 -2
- mlrun/data_types/infer.py +3 -1
- mlrun/data_types/spark.py +2 -1
- mlrun/datastore/__init__.py +0 -2
- mlrun/datastore/alibaba_oss.py +4 -1
- mlrun/datastore/azure_blob.py +4 -1
- mlrun/datastore/base.py +12 -4
- mlrun/datastore/datastore.py +9 -3
- mlrun/datastore/datastore_profile.py +79 -20
- mlrun/datastore/dbfs_store.py +4 -1
- mlrun/datastore/filestore.py +4 -1
- mlrun/datastore/google_cloud_storage.py +4 -1
- mlrun/datastore/hdfs.py +4 -1
- mlrun/datastore/inmem.py +4 -1
- mlrun/datastore/redis.py +4 -1
- mlrun/datastore/s3.py +4 -1
- mlrun/datastore/sources.py +52 -51
- mlrun/datastore/store_resources.py +0 -2
- mlrun/datastore/targets.py +21 -21
- mlrun/datastore/utils.py +2 -2
- mlrun/datastore/v3io.py +4 -1
- mlrun/datastore/vectorstore.py +194 -0
- mlrun/datastore/wasbfs/fs.py +13 -12
- mlrun/db/base.py +208 -82
- mlrun/db/factory.py +0 -3
- mlrun/db/httpdb.py +1237 -386
- mlrun/db/nopdb.py +201 -74
- mlrun/errors.py +2 -2
- mlrun/execution.py +136 -50
- mlrun/feature_store/__init__.py +0 -2
- mlrun/feature_store/api.py +41 -40
- mlrun/feature_store/common.py +9 -9
- mlrun/feature_store/feature_set.py +20 -18
- mlrun/feature_store/feature_vector.py +27 -24
- mlrun/feature_store/retrieval/base.py +14 -9
- mlrun/feature_store/retrieval/job.py +2 -1
- mlrun/feature_store/steps.py +2 -2
- mlrun/features.py +30 -13
- mlrun/frameworks/__init__.py +1 -2
- mlrun/frameworks/_common/__init__.py +1 -2
- mlrun/frameworks/_common/artifacts_library.py +2 -2
- mlrun/frameworks/_common/mlrun_interface.py +10 -6
- mlrun/frameworks/_common/model_handler.py +29 -27
- mlrun/frameworks/_common/producer.py +3 -1
- mlrun/frameworks/_dl_common/__init__.py +1 -2
- mlrun/frameworks/_dl_common/loggers/__init__.py +1 -2
- mlrun/frameworks/_dl_common/loggers/mlrun_logger.py +4 -4
- mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +3 -3
- mlrun/frameworks/_ml_common/__init__.py +1 -2
- mlrun/frameworks/_ml_common/loggers/__init__.py +1 -2
- mlrun/frameworks/_ml_common/model_handler.py +21 -21
- mlrun/frameworks/_ml_common/plans/__init__.py +1 -2
- mlrun/frameworks/_ml_common/plans/confusion_matrix_plan.py +3 -1
- mlrun/frameworks/_ml_common/plans/dataset_plan.py +3 -3
- mlrun/frameworks/_ml_common/plans/roc_curve_plan.py +4 -4
- mlrun/frameworks/auto_mlrun/__init__.py +1 -2
- mlrun/frameworks/auto_mlrun/auto_mlrun.py +22 -15
- mlrun/frameworks/huggingface/__init__.py +1 -2
- mlrun/frameworks/huggingface/model_server.py +9 -9
- mlrun/frameworks/lgbm/__init__.py +47 -44
- mlrun/frameworks/lgbm/callbacks/__init__.py +1 -2
- mlrun/frameworks/lgbm/callbacks/logging_callback.py +4 -2
- mlrun/frameworks/lgbm/callbacks/mlrun_logging_callback.py +4 -2
- mlrun/frameworks/lgbm/mlrun_interfaces/__init__.py +1 -2
- mlrun/frameworks/lgbm/mlrun_interfaces/mlrun_interface.py +5 -5
- mlrun/frameworks/lgbm/model_handler.py +15 -11
- mlrun/frameworks/lgbm/model_server.py +11 -7
- mlrun/frameworks/lgbm/utils.py +2 -2
- mlrun/frameworks/onnx/__init__.py +1 -2
- mlrun/frameworks/onnx/dataset.py +3 -3
- mlrun/frameworks/onnx/mlrun_interface.py +2 -2
- mlrun/frameworks/onnx/model_handler.py +7 -5
- mlrun/frameworks/onnx/model_server.py +8 -6
- mlrun/frameworks/parallel_coordinates.py +11 -11
- mlrun/frameworks/pytorch/__init__.py +22 -23
- mlrun/frameworks/pytorch/callbacks/__init__.py +1 -2
- mlrun/frameworks/pytorch/callbacks/callback.py +2 -1
- mlrun/frameworks/pytorch/callbacks/logging_callback.py +15 -8
- mlrun/frameworks/pytorch/callbacks/mlrun_logging_callback.py +19 -12
- mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py +22 -15
- mlrun/frameworks/pytorch/callbacks_handler.py +36 -30
- mlrun/frameworks/pytorch/mlrun_interface.py +17 -17
- mlrun/frameworks/pytorch/model_handler.py +21 -17
- mlrun/frameworks/pytorch/model_server.py +13 -9
- mlrun/frameworks/sklearn/__init__.py +19 -18
- mlrun/frameworks/sklearn/estimator.py +2 -2
- mlrun/frameworks/sklearn/metric.py +3 -3
- mlrun/frameworks/sklearn/metrics_library.py +8 -6
- mlrun/frameworks/sklearn/mlrun_interface.py +3 -2
- mlrun/frameworks/sklearn/model_handler.py +4 -3
- mlrun/frameworks/tf_keras/__init__.py +11 -12
- mlrun/frameworks/tf_keras/callbacks/__init__.py +1 -2
- mlrun/frameworks/tf_keras/callbacks/logging_callback.py +17 -14
- mlrun/frameworks/tf_keras/callbacks/mlrun_logging_callback.py +15 -12
- mlrun/frameworks/tf_keras/callbacks/tensorboard_logging_callback.py +21 -18
- mlrun/frameworks/tf_keras/model_handler.py +17 -13
- mlrun/frameworks/tf_keras/model_server.py +12 -8
- mlrun/frameworks/xgboost/__init__.py +19 -18
- mlrun/frameworks/xgboost/model_handler.py +13 -9
- mlrun/launcher/base.py +3 -4
- mlrun/launcher/local.py +1 -1
- mlrun/launcher/remote.py +1 -1
- mlrun/lists.py +4 -3
- mlrun/model.py +117 -46
- mlrun/model_monitoring/__init__.py +4 -4
- mlrun/model_monitoring/api.py +61 -59
- mlrun/model_monitoring/applications/_application_steps.py +17 -17
- mlrun/model_monitoring/applications/base.py +165 -6
- mlrun/model_monitoring/applications/context.py +88 -37
- mlrun/model_monitoring/applications/evidently_base.py +1 -2
- mlrun/model_monitoring/applications/histogram_data_drift.py +43 -21
- mlrun/model_monitoring/applications/results.py +55 -3
- mlrun/model_monitoring/controller.py +207 -239
- mlrun/model_monitoring/db/__init__.py +0 -2
- mlrun/model_monitoring/db/_schedules.py +156 -0
- mlrun/model_monitoring/db/_stats.py +189 -0
- mlrun/model_monitoring/db/tsdb/base.py +78 -25
- mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +90 -16
- mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +33 -0
- mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +279 -59
- mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +1 -0
- mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +78 -17
- mlrun/model_monitoring/helpers.py +152 -49
- mlrun/model_monitoring/stream_processing.py +99 -283
- mlrun/model_monitoring/tracking_policy.py +10 -3
- mlrun/model_monitoring/writer.py +48 -36
- mlrun/package/__init__.py +3 -6
- mlrun/package/context_handler.py +1 -1
- mlrun/package/packager.py +12 -9
- mlrun/package/packagers/__init__.py +0 -2
- mlrun/package/packagers/default_packager.py +14 -11
- mlrun/package/packagers/numpy_packagers.py +16 -7
- mlrun/package/packagers/pandas_packagers.py +18 -18
- mlrun/package/packagers/python_standard_library_packagers.py +25 -11
- mlrun/package/packagers_manager.py +31 -14
- mlrun/package/utils/__init__.py +0 -3
- mlrun/package/utils/_pickler.py +6 -6
- mlrun/platforms/__init__.py +47 -16
- mlrun/platforms/iguazio.py +4 -1
- mlrun/projects/operations.py +27 -27
- mlrun/projects/pipelines.py +75 -38
- mlrun/projects/project.py +865 -206
- mlrun/run.py +53 -10
- mlrun/runtimes/__init__.py +1 -3
- mlrun/runtimes/base.py +15 -11
- mlrun/runtimes/daskjob.py +9 -9
- mlrun/runtimes/generators.py +2 -1
- mlrun/runtimes/kubejob.py +4 -5
- mlrun/runtimes/mounts.py +572 -0
- mlrun/runtimes/mpijob/__init__.py +0 -2
- mlrun/runtimes/mpijob/abstract.py +7 -6
- mlrun/runtimes/nuclio/api_gateway.py +7 -7
- mlrun/runtimes/nuclio/application/application.py +11 -11
- mlrun/runtimes/nuclio/function.py +19 -17
- mlrun/runtimes/nuclio/serving.py +18 -11
- mlrun/runtimes/pod.py +154 -45
- mlrun/runtimes/remotesparkjob.py +3 -2
- mlrun/runtimes/sparkjob/__init__.py +0 -2
- mlrun/runtimes/sparkjob/spark3job.py +21 -11
- mlrun/runtimes/utils.py +6 -5
- mlrun/serving/merger.py +6 -4
- mlrun/serving/remote.py +18 -17
- mlrun/serving/routers.py +185 -172
- mlrun/serving/server.py +7 -1
- mlrun/serving/states.py +97 -78
- mlrun/serving/utils.py +13 -2
- mlrun/serving/v1_serving.py +3 -2
- mlrun/serving/v2_serving.py +74 -65
- mlrun/track/__init__.py +1 -1
- mlrun/track/tracker.py +2 -2
- mlrun/track/trackers/mlflow_tracker.py +6 -5
- mlrun/utils/async_http.py +1 -1
- mlrun/utils/clones.py +1 -1
- mlrun/utils/helpers.py +66 -18
- mlrun/utils/logger.py +106 -4
- mlrun/utils/notifications/notification/__init__.py +22 -19
- mlrun/utils/notifications/notification/base.py +33 -14
- mlrun/utils/notifications/notification/console.py +6 -6
- mlrun/utils/notifications/notification/git.py +11 -11
- mlrun/utils/notifications/notification/ipython.py +10 -9
- mlrun/utils/notifications/notification/mail.py +176 -0
- mlrun/utils/notifications/notification/slack.py +6 -6
- mlrun/utils/notifications/notification/webhook.py +6 -6
- mlrun/utils/notifications/notification_pusher.py +86 -44
- mlrun/utils/regex.py +3 -1
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.7.1rc4.dist-info → mlrun-1.8.0rc8.dist-info}/METADATA +191 -186
- mlrun-1.8.0rc8.dist-info/RECORD +347 -0
- {mlrun-1.7.1rc4.dist-info → mlrun-1.8.0rc8.dist-info}/WHEEL +1 -1
- mlrun/model_monitoring/db/stores/__init__.py +0 -136
- mlrun/model_monitoring/db/stores/base/store.py +0 -213
- mlrun/model_monitoring/db/stores/sqldb/__init__.py +0 -13
- mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +0 -71
- mlrun/model_monitoring/db/stores/sqldb/models/base.py +0 -190
- mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +0 -103
- mlrun/model_monitoring/db/stores/sqldb/models/sqlite.py +0 -40
- mlrun/model_monitoring/db/stores/sqldb/sql_store.py +0 -659
- mlrun/model_monitoring/db/stores/v3io_kv/__init__.py +0 -13
- mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +0 -726
- mlrun/model_monitoring/model_endpoint.py +0 -118
- mlrun-1.7.1rc4.dist-info/RECORD +0 -351
- {mlrun-1.7.1rc4.dist-info → mlrun-1.8.0rc8.dist-info}/LICENSE +0 -0
- {mlrun-1.7.1rc4.dist-info → mlrun-1.8.0rc8.dist-info}/entry_points.txt +0 -0
- {mlrun-1.7.1rc4.dist-info → mlrun-1.8.0rc8.dist-info}/top_level.txt +0 -0
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
from typing import Any, Union
|
|
15
|
+
from typing import Any, Optional, Union
|
|
16
16
|
|
|
17
17
|
import numpy as np
|
|
18
18
|
|
|
@@ -32,16 +32,20 @@ class LGBMModelServer(V2ModelServer):
|
|
|
32
32
|
def __init__(
|
|
33
33
|
self,
|
|
34
34
|
context: mlrun.MLClientCtx = None,
|
|
35
|
-
name: str = None,
|
|
35
|
+
name: Optional[str] = None,
|
|
36
36
|
model: LGBMTypes.ModelType = None,
|
|
37
37
|
model_path: LGBMTypes.PathType = None,
|
|
38
|
-
model_name: str = None,
|
|
38
|
+
model_name: Optional[str] = None,
|
|
39
39
|
model_format: str = LGBMModelHandler.ModelFormats.PKL,
|
|
40
|
-
modules_map:
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
modules_map: Optional[
|
|
41
|
+
Union[dict[str, Union[None, str, list[str]]], str]
|
|
42
|
+
] = None,
|
|
43
|
+
custom_objects_map: Optional[
|
|
44
|
+
Union[dict[str, Union[str, list[str]]], str]
|
|
45
|
+
] = None,
|
|
46
|
+
custom_objects_directory: Optional[str] = None,
|
|
43
47
|
to_list: bool = True,
|
|
44
|
-
protocol: str = None,
|
|
48
|
+
protocol: Optional[str] = None,
|
|
45
49
|
**class_args,
|
|
46
50
|
):
|
|
47
51
|
"""
|
mlrun/frameworks/lgbm/utils.py
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
from typing import Union
|
|
15
|
+
from typing import Optional, Union
|
|
16
16
|
|
|
17
17
|
import lightgbm as lgb
|
|
18
18
|
import numpy as np
|
|
@@ -109,7 +109,7 @@ class LGBMUtils(MLUtils):
|
|
|
109
109
|
def get_algorithm_functionality(
|
|
110
110
|
model: MLTypes.ModelType = None,
|
|
111
111
|
y: MLTypes.DatasetType = None,
|
|
112
|
-
objective: str = None,
|
|
112
|
+
objective: Optional[str] = None,
|
|
113
113
|
) -> AlgorithmFunctionality:
|
|
114
114
|
"""
|
|
115
115
|
Get the algorithm functionality of the LightGBM model. If SciKit-Learn API is used, pass the LGBBMModel and a y
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
-
|
|
15
|
-
# flake8: noqa - this is until we take care of the F401 violations with respect to __all__ & sphinx
|
|
14
|
+
|
|
16
15
|
from .dataset import ONNXDataset
|
|
17
16
|
from .model_handler import ONNXModelHandler
|
|
18
17
|
from .model_server import ONNXModelServer
|
mlrun/frameworks/onnx/dataset.py
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
import math
|
|
16
|
-
from typing import Callable, Union
|
|
16
|
+
from typing import Callable, Optional, Union
|
|
17
17
|
|
|
18
18
|
import numpy as np
|
|
19
19
|
|
|
@@ -28,8 +28,8 @@ class ONNXDataset:
|
|
|
28
28
|
x: Union[np.ndarray, list[np.ndarray]],
|
|
29
29
|
y: Union[np.ndarray, list[np.ndarray]] = None,
|
|
30
30
|
batch_size: int = 1,
|
|
31
|
-
x_transforms: list[Callable[[np.ndarray], np.ndarray]] = None,
|
|
32
|
-
y_transforms: list[Callable[[np.ndarray], np.ndarray]] = None,
|
|
31
|
+
x_transforms: Optional[list[Callable[[np.ndarray], np.ndarray]]] = None,
|
|
32
|
+
y_transforms: Optional[list[Callable[[np.ndarray], np.ndarray]]] = None,
|
|
33
33
|
is_batched_transforms: bool = False,
|
|
34
34
|
):
|
|
35
35
|
"""
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
from typing import Callable
|
|
15
|
+
from typing import Callable, Optional
|
|
16
16
|
|
|
17
17
|
import numpy as np
|
|
18
18
|
import onnx
|
|
@@ -35,7 +35,7 @@ class ONNXMLRunInterface:
|
|
|
35
35
|
def __init__(
|
|
36
36
|
self,
|
|
37
37
|
model: onnx.ModelProto,
|
|
38
|
-
execution_providers: list[str] = None,
|
|
38
|
+
execution_providers: Optional[list[str]] = None,
|
|
39
39
|
context: mlrun.MLClientCtx = None,
|
|
40
40
|
):
|
|
41
41
|
# Set the context:
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
import os
|
|
16
|
-
from typing import Union
|
|
16
|
+
from typing import Optional, Union
|
|
17
17
|
|
|
18
18
|
import onnx
|
|
19
19
|
import onnxoptimizer
|
|
@@ -35,8 +35,8 @@ class ONNXModelHandler(ModelHandler):
|
|
|
35
35
|
def __init__(
|
|
36
36
|
self,
|
|
37
37
|
model: onnx.ModelProto = None,
|
|
38
|
-
model_path: str = None,
|
|
39
|
-
model_name: str = None,
|
|
38
|
+
model_path: Optional[str] = None,
|
|
39
|
+
model_name: Optional[str] = None,
|
|
40
40
|
context: mlrun.MLClientCtx = None,
|
|
41
41
|
**kwargs,
|
|
42
42
|
):
|
|
@@ -70,7 +70,7 @@ class ONNXModelHandler(ModelHandler):
|
|
|
70
70
|
|
|
71
71
|
# TODO: output_path won't work well with logging artifacts. Need to look into changing the logic of 'log_artifact'.
|
|
72
72
|
def save(
|
|
73
|
-
self, output_path: str = None, **kwargs
|
|
73
|
+
self, output_path: Optional[str] = None, **kwargs
|
|
74
74
|
) -> Union[dict[str, Artifact], None]:
|
|
75
75
|
"""
|
|
76
76
|
Save the handled model at the given output path. If a MLRun context is available, the saved model files will be
|
|
@@ -106,7 +106,9 @@ class ONNXModelHandler(ModelHandler):
|
|
|
106
106
|
# Load the ONNX model:
|
|
107
107
|
self._model = onnx.load(self._model_file)
|
|
108
108
|
|
|
109
|
-
def optimize(
|
|
109
|
+
def optimize(
|
|
110
|
+
self, optimizations: Optional[list[str]] = None, fixed_point: bool = False
|
|
111
|
+
):
|
|
110
112
|
"""
|
|
111
113
|
Use ONNX optimizer to optimize the ONNX model. The optimizations supported can be seen by calling
|
|
112
114
|
'onnxoptimizer.get_available_passes()'
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
from typing import Any, Union
|
|
15
|
+
from typing import Any, Optional, Union
|
|
16
16
|
|
|
17
17
|
import numpy as np
|
|
18
18
|
import onnx
|
|
@@ -33,12 +33,14 @@ class ONNXModelServer(V2ModelServer):
|
|
|
33
33
|
def __init__(
|
|
34
34
|
self,
|
|
35
35
|
context: mlrun.MLClientCtx = None,
|
|
36
|
-
name: str = None,
|
|
36
|
+
name: Optional[str] = None,
|
|
37
37
|
model: onnx.ModelProto = None,
|
|
38
|
-
model_path: str = None,
|
|
39
|
-
model_name: str = None,
|
|
40
|
-
execution_providers:
|
|
41
|
-
|
|
38
|
+
model_path: Optional[str] = None,
|
|
39
|
+
model_name: Optional[str] = None,
|
|
40
|
+
execution_providers: Optional[
|
|
41
|
+
list[Union[str, tuple[str, dict[str, Any]]]]
|
|
42
|
+
] = None,
|
|
43
|
+
protocol: Optional[str] = None,
|
|
42
44
|
**class_args,
|
|
43
45
|
):
|
|
44
46
|
"""
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
-
|
|
15
|
-
import datetime
|
|
14
|
+
|
|
16
15
|
import os
|
|
17
|
-
from
|
|
16
|
+
from datetime import datetime
|
|
17
|
+
from typing import Optional, Union
|
|
18
18
|
|
|
19
19
|
import numpy as np
|
|
20
20
|
import pandas as pd
|
|
@@ -48,7 +48,7 @@ def _gen_dropdown_buttons(output_cols) -> list:
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
def _gen_dimensions(
|
|
51
|
-
df: pd.DataFrame, col: str, prefix: str = None, is_index=False
|
|
51
|
+
df: pd.DataFrame, col: str, prefix: Optional[str] = None, is_index=False
|
|
52
52
|
) -> dict:
|
|
53
53
|
"""
|
|
54
54
|
Computes the plotting dimensions of each parameter/output col according to its type.
|
|
@@ -107,8 +107,8 @@ def gen_pcp_plot(
|
|
|
107
107
|
source_df: pd.DataFrame,
|
|
108
108
|
index_col: str,
|
|
109
109
|
hide_identical: bool = True,
|
|
110
|
-
exclude: list = None,
|
|
111
|
-
colorscale: str = None,
|
|
110
|
+
exclude: Optional[list] = None,
|
|
111
|
+
colorscale: Optional[str] = None,
|
|
112
112
|
):
|
|
113
113
|
"""
|
|
114
114
|
Creates a list composed of the data to be plotted as a Parallel Coordinate, this includes
|
|
@@ -240,11 +240,11 @@ def _runs_list_to_df(runs_list, extend_iterations=False):
|
|
|
240
240
|
def compare_run_objects(
|
|
241
241
|
runs_list: Union[mlrun.model.RunObject, list[mlrun.model.RunObject]],
|
|
242
242
|
hide_identical: bool = True,
|
|
243
|
-
exclude: list = None,
|
|
244
|
-
show: bool = None,
|
|
243
|
+
exclude: Optional[list] = None,
|
|
244
|
+
show: Optional[bool] = None,
|
|
245
245
|
extend_iterations=True,
|
|
246
246
|
filename=None,
|
|
247
|
-
colorscale: str = None,
|
|
247
|
+
colorscale: Optional[str] = None,
|
|
248
248
|
):
|
|
249
249
|
"""return/show parallel coordinates plot + table to compare between a list of runs or run iterations
|
|
250
250
|
|
|
@@ -292,9 +292,9 @@ def compare_db_runs(
|
|
|
292
292
|
run_name=None,
|
|
293
293
|
labels=None,
|
|
294
294
|
iter=False,
|
|
295
|
-
start_time_from: datetime = None,
|
|
295
|
+
start_time_from: Optional[datetime] = None,
|
|
296
296
|
hide_identical: bool = True,
|
|
297
|
-
exclude: list = None,
|
|
297
|
+
exclude: Optional[list] = None,
|
|
298
298
|
show=None,
|
|
299
299
|
colorscale: str = "Blues",
|
|
300
300
|
filename=None,
|
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
from typing import Any, Union
|
|
14
|
+
|
|
15
|
+
from typing import Any, Optional, Union
|
|
17
16
|
|
|
18
17
|
from torch.nn import Module
|
|
19
18
|
from torch.optim import Optimizer
|
|
@@ -35,23 +34,23 @@ def train(
|
|
|
35
34
|
loss_function: Module,
|
|
36
35
|
optimizer: Optimizer,
|
|
37
36
|
validation_set: DataLoader = None,
|
|
38
|
-
metric_functions: list[PyTorchTypes.MetricFunctionType] = None,
|
|
37
|
+
metric_functions: Optional[list[PyTorchTypes.MetricFunctionType]] = None,
|
|
39
38
|
scheduler=None,
|
|
40
39
|
scheduler_step_frequency: Union[int, float, str] = "epoch",
|
|
41
40
|
epochs: int = 1,
|
|
42
|
-
training_iterations: int = None,
|
|
43
|
-
validation_iterations: int = None,
|
|
44
|
-
callbacks_list: list[Callback] = None,
|
|
41
|
+
training_iterations: Optional[int] = None,
|
|
42
|
+
validation_iterations: Optional[int] = None,
|
|
43
|
+
callbacks_list: Optional[list[Callback]] = None,
|
|
45
44
|
use_cuda: bool = True,
|
|
46
|
-
use_horovod: bool = None,
|
|
45
|
+
use_horovod: Optional[bool] = None,
|
|
47
46
|
auto_log: bool = True,
|
|
48
|
-
model_name: str = None,
|
|
49
|
-
modules_map: Union[dict[str, Union[None, str, list[str]]], str] = None,
|
|
50
|
-
custom_objects_map: Union[dict[str, Union[str, list[str]]], str] = None,
|
|
51
|
-
custom_objects_directory: str = None,
|
|
52
|
-
tensorboard_directory: str = None,
|
|
53
|
-
mlrun_callback_kwargs: dict[str, Any] = None,
|
|
54
|
-
tensorboard_callback_kwargs: dict[str, Any] = None,
|
|
47
|
+
model_name: Optional[str] = None,
|
|
48
|
+
modules_map: Optional[Union[dict[str, Union[None, str, list[str]]], str]] = None,
|
|
49
|
+
custom_objects_map: Optional[Union[dict[str, Union[str, list[str]]], str]] = None,
|
|
50
|
+
custom_objects_directory: Optional[str] = None,
|
|
51
|
+
tensorboard_directory: Optional[str] = None,
|
|
52
|
+
mlrun_callback_kwargs: Optional[dict[str, Any]] = None,
|
|
53
|
+
tensorboard_callback_kwargs: Optional[dict[str, Any]] = None,
|
|
55
54
|
context: mlrun.MLClientCtx = None,
|
|
56
55
|
) -> PyTorchModelHandler:
|
|
57
56
|
"""
|
|
@@ -205,17 +204,17 @@ def evaluate(
|
|
|
205
204
|
dataset: DataLoader,
|
|
206
205
|
model: Module = None,
|
|
207
206
|
loss_function: Module = None,
|
|
208
|
-
metric_functions: list[PyTorchTypes.MetricFunctionType] = None,
|
|
209
|
-
iterations: int = None,
|
|
210
|
-
callbacks_list: list[Callback] = None,
|
|
207
|
+
metric_functions: Optional[list[PyTorchTypes.MetricFunctionType]] = None,
|
|
208
|
+
iterations: Optional[int] = None,
|
|
209
|
+
callbacks_list: Optional[list[Callback]] = None,
|
|
211
210
|
use_cuda: bool = True,
|
|
212
211
|
use_horovod: bool = False,
|
|
213
212
|
auto_log: bool = True,
|
|
214
|
-
model_name: str = None,
|
|
215
|
-
modules_map: Union[dict[str, Union[None, str, list[str]]], str] = None,
|
|
216
|
-
custom_objects_map: Union[dict[str, Union[str, list[str]]], str] = None,
|
|
217
|
-
custom_objects_directory: str = None,
|
|
218
|
-
mlrun_callback_kwargs: dict[str, Any] = None,
|
|
213
|
+
model_name: Optional[str] = None,
|
|
214
|
+
modules_map: Optional[Union[dict[str, Union[None, str, list[str]]], str]] = None,
|
|
215
|
+
custom_objects_map: Optional[Union[dict[str, Union[str, list[str]]], str]] = None,
|
|
216
|
+
custom_objects_directory: Optional[str] = None,
|
|
217
|
+
mlrun_callback_kwargs: Optional[dict[str, Any]] = None,
|
|
219
218
|
context: mlrun.MLClientCtx = None,
|
|
220
219
|
) -> tuple[PyTorchModelHandler, list[PyTorchTypes.MetricValueType]]:
|
|
221
220
|
"""
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
-
|
|
15
|
-
# flake8: noqa - this is until we take care of the F401 violations with respect to __all__ & sphinx
|
|
14
|
+
|
|
16
15
|
from .callback import Callback
|
|
17
16
|
from .logging_callback import HyperparametersKeys, LoggingCallback
|
|
18
17
|
from .mlrun_logging_callback import MLRunLoggingCallback
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
from abc import ABC, abstractmethod
|
|
16
|
+
from typing import Optional
|
|
16
17
|
|
|
17
18
|
from torch import Tensor
|
|
18
19
|
from torch.nn import Module
|
|
@@ -67,7 +68,7 @@ class Callback(ABC):
|
|
|
67
68
|
validation_set: DataLoader = None,
|
|
68
69
|
loss_function: Module = None,
|
|
69
70
|
optimizer: Optimizer = None,
|
|
70
|
-
metric_functions: list[PyTorchTypes.MetricFunctionType] = None,
|
|
71
|
+
metric_functions: Optional[list[PyTorchTypes.MetricFunctionType]] = None,
|
|
71
72
|
scheduler=None,
|
|
72
73
|
):
|
|
73
74
|
"""
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
from typing import Callable, Union
|
|
15
|
+
from typing import Callable, Optional, Union
|
|
16
16
|
|
|
17
17
|
import numpy as np
|
|
18
18
|
from torch import Tensor
|
|
@@ -59,15 +59,22 @@ class LoggingCallback(Callback):
|
|
|
59
59
|
def __init__(
|
|
60
60
|
self,
|
|
61
61
|
context: mlrun.MLClientCtx = None,
|
|
62
|
-
dynamic_hyperparameters:
|
|
63
|
-
|
|
64
|
-
tuple[
|
|
62
|
+
dynamic_hyperparameters: Optional[
|
|
63
|
+
dict[
|
|
65
64
|
str,
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
tuple[
|
|
66
|
+
str,
|
|
67
|
+
Union[
|
|
68
|
+
list[Union[str, int]], Callable[[], PyTorchTypes.TrackableType]
|
|
69
|
+
],
|
|
70
|
+
],
|
|
71
|
+
]
|
|
68
72
|
] = None,
|
|
69
|
-
static_hyperparameters:
|
|
70
|
-
|
|
73
|
+
static_hyperparameters: Optional[
|
|
74
|
+
dict[
|
|
75
|
+
str,
|
|
76
|
+
Union[PyTorchTypes.TrackableType, tuple[str, list[Union[str, int]]]],
|
|
77
|
+
]
|
|
71
78
|
] = None,
|
|
72
79
|
auto_log: bool = False,
|
|
73
80
|
):
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
from typing import Callable, Union
|
|
15
|
+
from typing import Callable, Optional, Union
|
|
16
16
|
|
|
17
17
|
import torch
|
|
18
18
|
from torch import Tensor
|
|
@@ -53,20 +53,27 @@ class MLRunLoggingCallback(LoggingCallback):
|
|
|
53
53
|
context: mlrun.MLClientCtx,
|
|
54
54
|
model_handler: PyTorchModelHandler,
|
|
55
55
|
log_model_tag: str = "",
|
|
56
|
-
log_model_labels: dict[str, PyTorchTypes.TrackableType] = None,
|
|
57
|
-
log_model_parameters: dict[str, PyTorchTypes.TrackableType] = None,
|
|
58
|
-
log_model_extra_data:
|
|
59
|
-
str, Union[PyTorchTypes.TrackableType, Artifact]
|
|
56
|
+
log_model_labels: Optional[dict[str, PyTorchTypes.TrackableType]] = None,
|
|
57
|
+
log_model_parameters: Optional[dict[str, PyTorchTypes.TrackableType]] = None,
|
|
58
|
+
log_model_extra_data: Optional[
|
|
59
|
+
dict[str, Union[PyTorchTypes.TrackableType, Artifact]]
|
|
60
60
|
] = None,
|
|
61
|
-
dynamic_hyperparameters:
|
|
62
|
-
|
|
63
|
-
tuple[
|
|
61
|
+
dynamic_hyperparameters: Optional[
|
|
62
|
+
dict[
|
|
64
63
|
str,
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
tuple[
|
|
65
|
+
str,
|
|
66
|
+
Union[
|
|
67
|
+
list[Union[str, int]], Callable[[], PyTorchTypes.TrackableType]
|
|
68
|
+
],
|
|
69
|
+
],
|
|
70
|
+
]
|
|
67
71
|
] = None,
|
|
68
|
-
static_hyperparameters:
|
|
69
|
-
|
|
72
|
+
static_hyperparameters: Optional[
|
|
73
|
+
dict[
|
|
74
|
+
str,
|
|
75
|
+
Union[PyTorchTypes.TrackableType, tuple[str, list[Union[str, int]]]],
|
|
76
|
+
]
|
|
70
77
|
] = None,
|
|
71
78
|
auto_log: bool = False,
|
|
72
79
|
):
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
from datetime import datetime
|
|
16
|
-
from typing import Callable, Union
|
|
16
|
+
from typing import Callable, Optional, Union
|
|
17
17
|
|
|
18
18
|
import torch
|
|
19
19
|
from torch import Tensor
|
|
@@ -67,8 +67,8 @@ class _PyTorchTensorboardLogger(TensorboardLogger):
|
|
|
67
67
|
Callable[[Union[Parameter]], Union[float, Parameter]]
|
|
68
68
|
],
|
|
69
69
|
context: mlrun.MLClientCtx = None,
|
|
70
|
-
tensorboard_directory: str = None,
|
|
71
|
-
run_name: str = None,
|
|
70
|
+
tensorboard_directory: Optional[str] = None,
|
|
71
|
+
run_name: Optional[str] = None,
|
|
72
72
|
update_frequency: Union[int, str] = "epoch",
|
|
73
73
|
):
|
|
74
74
|
"""
|
|
@@ -247,21 +247,28 @@ class TensorboardLoggingCallback(LoggingCallback):
|
|
|
247
247
|
def __init__(
|
|
248
248
|
self,
|
|
249
249
|
context: mlrun.MLClientCtx = None,
|
|
250
|
-
tensorboard_directory: str = None,
|
|
251
|
-
run_name: str = None,
|
|
250
|
+
tensorboard_directory: Optional[str] = None,
|
|
251
|
+
run_name: Optional[str] = None,
|
|
252
252
|
weights: Union[bool, list[str]] = False,
|
|
253
|
-
statistics_functions:
|
|
254
|
-
Callable[[Union[Parameter, Tensor]], Union[float, Tensor]]
|
|
253
|
+
statistics_functions: Optional[
|
|
254
|
+
list[Callable[[Union[Parameter, Tensor]], Union[float, Tensor]]]
|
|
255
255
|
] = None,
|
|
256
|
-
dynamic_hyperparameters:
|
|
257
|
-
|
|
258
|
-
tuple[
|
|
256
|
+
dynamic_hyperparameters: Optional[
|
|
257
|
+
dict[
|
|
259
258
|
str,
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
tuple[
|
|
260
|
+
str,
|
|
261
|
+
Union[
|
|
262
|
+
list[Union[str, int]], Callable[[], PyTorchTypes.TrackableType]
|
|
263
|
+
],
|
|
264
|
+
],
|
|
265
|
+
]
|
|
262
266
|
] = None,
|
|
263
|
-
static_hyperparameters:
|
|
264
|
-
|
|
267
|
+
static_hyperparameters: Optional[
|
|
268
|
+
dict[
|
|
269
|
+
str,
|
|
270
|
+
Union[PyTorchTypes.TrackableType, tuple[str, list[Union[str, int]]]],
|
|
271
|
+
]
|
|
265
272
|
] = None,
|
|
266
273
|
update_frequency: Union[int, str] = "epoch",
|
|
267
274
|
auto_log: bool = False,
|
|
@@ -381,7 +388,7 @@ class TensorboardLoggingCallback(LoggingCallback):
|
|
|
381
388
|
validation_set: DataLoader = None,
|
|
382
389
|
loss_function: Module = None,
|
|
383
390
|
optimizer: Optimizer = None,
|
|
384
|
-
metric_functions: list[PyTorchTypes.MetricFunctionType] = None,
|
|
391
|
+
metric_functions: Optional[list[PyTorchTypes.MetricFunctionType]] = None,
|
|
385
392
|
scheduler=None,
|
|
386
393
|
):
|
|
387
394
|
"""
|