snowflake-ml-python 1.6.2__py3-none-any.whl → 1.6.3__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.
- snowflake/cortex/__init__.py +4 -0
- snowflake/cortex/_classify_text.py +2 -2
- snowflake/cortex/_embed_text_1024.py +37 -0
- snowflake/cortex/_embed_text_768.py +37 -0
- snowflake/cortex/_extract_answer.py +2 -2
- snowflake/cortex/_sentiment.py +2 -2
- snowflake/cortex/_summarize.py +2 -2
- snowflake/cortex/_translate.py +2 -2
- snowflake/cortex/_util.py +4 -4
- snowflake/ml/_internal/env_utils.py +5 -5
- snowflake/ml/_internal/exceptions/error_codes.py +2 -0
- snowflake/ml/_internal/utils/db_utils.py +50 -0
- snowflake/ml/_internal/utils/service_logger.py +63 -0
- snowflake/ml/_internal/utils/sql_identifier.py +25 -1
- snowflake/ml/data/_internal/arrow_ingestor.py +1 -11
- snowflake/ml/data/ingestor_utils.py +20 -10
- snowflake/ml/feature_store/access_manager.py +3 -3
- snowflake/ml/feature_store/feature_store.py +19 -2
- snowflake/ml/feature_store/feature_view.py +82 -28
- snowflake/ml/fileset/stage_fs.py +2 -1
- snowflake/ml/lineage/lineage_node.py +7 -2
- snowflake/ml/model/__init__.py +1 -2
- snowflake/ml/model/_client/model/model_version_impl.py +78 -9
- snowflake/ml/model/_client/ops/model_ops.py +89 -7
- snowflake/ml/model/_client/ops/service_ops.py +200 -91
- snowflake/ml/model/_client/service/model_deployment_spec.py +4 -0
- snowflake/ml/model/_client/service/model_deployment_spec_schema.py +1 -0
- snowflake/ml/model/_client/sql/_base.py +5 -0
- snowflake/ml/model/_client/sql/model.py +1 -0
- snowflake/ml/model/_client/sql/model_version.py +9 -5
- snowflake/ml/model/_client/sql/service.py +47 -13
- snowflake/ml/model/_model_composer/model_composer.py +11 -41
- snowflake/ml/model/_model_composer/model_manifest/model_manifest.py +29 -4
- snowflake/ml/model/_packager/model_env/model_env.py +4 -38
- snowflake/ml/model/_packager/model_handlers/_utils.py +106 -32
- snowflake/ml/model/_packager/model_handlers/catboost.py +26 -27
- snowflake/ml/model/_packager/model_handlers/huggingface_pipeline.py +3 -3
- snowflake/ml/model/_packager/model_handlers/lightgbm.py +21 -6
- snowflake/ml/model/_packager/model_handlers/mlflow.py +3 -5
- snowflake/ml/model/_packager/model_handlers/model_objective_utils.py +111 -58
- snowflake/ml/model/_packager/model_handlers/sentence_transformers.py +15 -8
- snowflake/ml/model/_packager/model_handlers/sklearn.py +50 -66
- snowflake/ml/model/_packager/model_handlers/snowmlmodel.py +36 -17
- snowflake/ml/model/_packager/model_handlers/xgboost.py +22 -7
- snowflake/ml/model/_packager/model_meta/model_meta.py +16 -45
- snowflake/ml/model/_packager/model_meta/model_meta_schema.py +1 -6
- snowflake/ml/model/_packager/model_packager.py +14 -10
- snowflake/ml/model/_packager/model_runtime/model_runtime.py +11 -0
- snowflake/ml/model/_signatures/snowpark_handler.py +3 -2
- snowflake/ml/model/type_hints.py +11 -152
- snowflake/ml/modeling/_internal/snowpark_implementations/distributed_hpo_trainer.py +0 -2
- snowflake/ml/modeling/_internal/snowpark_implementations/snowpark_trainer.py +17 -6
- snowflake/ml/modeling/_internal/snowpark_implementations/xgboost_external_memory_trainer.py +0 -1
- snowflake/ml/modeling/calibration/calibrated_classifier_cv.py +1 -0
- snowflake/ml/modeling/cluster/affinity_propagation.py +1 -0
- snowflake/ml/modeling/cluster/agglomerative_clustering.py +1 -0
- snowflake/ml/modeling/cluster/birch.py +1 -0
- snowflake/ml/modeling/cluster/bisecting_k_means.py +1 -0
- snowflake/ml/modeling/cluster/dbscan.py +1 -0
- snowflake/ml/modeling/cluster/feature_agglomeration.py +1 -0
- snowflake/ml/modeling/cluster/k_means.py +1 -0
- snowflake/ml/modeling/cluster/mean_shift.py +1 -0
- snowflake/ml/modeling/cluster/mini_batch_k_means.py +1 -0
- snowflake/ml/modeling/cluster/optics.py +1 -0
- snowflake/ml/modeling/cluster/spectral_biclustering.py +1 -0
- snowflake/ml/modeling/cluster/spectral_clustering.py +1 -0
- snowflake/ml/modeling/cluster/spectral_coclustering.py +1 -0
- snowflake/ml/modeling/compose/column_transformer.py +1 -0
- snowflake/ml/modeling/compose/transformed_target_regressor.py +1 -0
- snowflake/ml/modeling/covariance/elliptic_envelope.py +1 -0
- snowflake/ml/modeling/covariance/empirical_covariance.py +1 -0
- snowflake/ml/modeling/covariance/graphical_lasso.py +1 -0
- snowflake/ml/modeling/covariance/graphical_lasso_cv.py +1 -0
- snowflake/ml/modeling/covariance/ledoit_wolf.py +1 -0
- snowflake/ml/modeling/covariance/min_cov_det.py +1 -0
- snowflake/ml/modeling/covariance/oas.py +1 -0
- snowflake/ml/modeling/covariance/shrunk_covariance.py +1 -0
- snowflake/ml/modeling/decomposition/dictionary_learning.py +1 -0
- snowflake/ml/modeling/decomposition/factor_analysis.py +1 -0
- snowflake/ml/modeling/decomposition/fast_ica.py +1 -0
- snowflake/ml/modeling/decomposition/incremental_pca.py +1 -0
- snowflake/ml/modeling/decomposition/kernel_pca.py +1 -0
- snowflake/ml/modeling/decomposition/mini_batch_dictionary_learning.py +1 -0
- snowflake/ml/modeling/decomposition/mini_batch_sparse_pca.py +1 -0
- snowflake/ml/modeling/decomposition/pca.py +1 -0
- snowflake/ml/modeling/decomposition/sparse_pca.py +1 -0
- snowflake/ml/modeling/decomposition/truncated_svd.py +1 -0
- snowflake/ml/modeling/discriminant_analysis/linear_discriminant_analysis.py +1 -0
- snowflake/ml/modeling/discriminant_analysis/quadratic_discriminant_analysis.py +1 -0
- snowflake/ml/modeling/ensemble/ada_boost_classifier.py +1 -0
- snowflake/ml/modeling/ensemble/ada_boost_regressor.py +1 -0
- snowflake/ml/modeling/ensemble/bagging_classifier.py +1 -0
- snowflake/ml/modeling/ensemble/bagging_regressor.py +1 -0
- snowflake/ml/modeling/ensemble/extra_trees_classifier.py +1 -0
- snowflake/ml/modeling/ensemble/extra_trees_regressor.py +1 -0
- snowflake/ml/modeling/ensemble/gradient_boosting_classifier.py +1 -0
- snowflake/ml/modeling/ensemble/gradient_boosting_regressor.py +1 -0
- snowflake/ml/modeling/ensemble/hist_gradient_boosting_classifier.py +1 -0
- snowflake/ml/modeling/ensemble/hist_gradient_boosting_regressor.py +1 -0
- snowflake/ml/modeling/ensemble/isolation_forest.py +1 -0
- snowflake/ml/modeling/ensemble/random_forest_classifier.py +1 -0
- snowflake/ml/modeling/ensemble/random_forest_regressor.py +1 -0
- snowflake/ml/modeling/ensemble/stacking_regressor.py +1 -0
- snowflake/ml/modeling/ensemble/voting_classifier.py +1 -0
- snowflake/ml/modeling/ensemble/voting_regressor.py +1 -0
- snowflake/ml/modeling/feature_selection/generic_univariate_select.py +1 -0
- snowflake/ml/modeling/feature_selection/select_fdr.py +1 -0
- snowflake/ml/modeling/feature_selection/select_fpr.py +1 -0
- snowflake/ml/modeling/feature_selection/select_fwe.py +1 -0
- snowflake/ml/modeling/feature_selection/select_k_best.py +1 -0
- snowflake/ml/modeling/feature_selection/select_percentile.py +1 -0
- snowflake/ml/modeling/feature_selection/sequential_feature_selector.py +1 -0
- snowflake/ml/modeling/feature_selection/variance_threshold.py +1 -0
- snowflake/ml/modeling/gaussian_process/gaussian_process_classifier.py +1 -0
- snowflake/ml/modeling/gaussian_process/gaussian_process_regressor.py +1 -0
- snowflake/ml/modeling/impute/iterative_imputer.py +1 -0
- snowflake/ml/modeling/impute/knn_imputer.py +1 -0
- snowflake/ml/modeling/impute/missing_indicator.py +1 -0
- snowflake/ml/modeling/kernel_approximation/additive_chi2_sampler.py +1 -0
- snowflake/ml/modeling/kernel_approximation/nystroem.py +1 -0
- snowflake/ml/modeling/kernel_approximation/polynomial_count_sketch.py +1 -0
- snowflake/ml/modeling/kernel_approximation/rbf_sampler.py +1 -0
- snowflake/ml/modeling/kernel_approximation/skewed_chi2_sampler.py +1 -0
- snowflake/ml/modeling/kernel_ridge/kernel_ridge.py +1 -0
- snowflake/ml/modeling/lightgbm/lgbm_classifier.py +1 -0
- snowflake/ml/modeling/lightgbm/lgbm_regressor.py +1 -0
- snowflake/ml/modeling/linear_model/ard_regression.py +1 -0
- snowflake/ml/modeling/linear_model/bayesian_ridge.py +1 -0
- snowflake/ml/modeling/linear_model/elastic_net.py +1 -0
- snowflake/ml/modeling/linear_model/elastic_net_cv.py +1 -0
- snowflake/ml/modeling/linear_model/gamma_regressor.py +1 -0
- snowflake/ml/modeling/linear_model/huber_regressor.py +1 -0
- snowflake/ml/modeling/linear_model/lars.py +1 -0
- snowflake/ml/modeling/linear_model/lars_cv.py +1 -0
- snowflake/ml/modeling/linear_model/lasso.py +1 -0
- snowflake/ml/modeling/linear_model/lasso_cv.py +1 -0
- snowflake/ml/modeling/linear_model/lasso_lars.py +1 -0
- snowflake/ml/modeling/linear_model/lasso_lars_cv.py +1 -0
- snowflake/ml/modeling/linear_model/lasso_lars_ic.py +1 -0
- snowflake/ml/modeling/linear_model/linear_regression.py +1 -0
- snowflake/ml/modeling/linear_model/logistic_regression.py +1 -0
- snowflake/ml/modeling/linear_model/logistic_regression_cv.py +1 -0
- snowflake/ml/modeling/linear_model/multi_task_elastic_net.py +1 -0
- snowflake/ml/modeling/linear_model/multi_task_elastic_net_cv.py +1 -0
- snowflake/ml/modeling/linear_model/multi_task_lasso.py +1 -0
- snowflake/ml/modeling/linear_model/multi_task_lasso_cv.py +1 -0
- snowflake/ml/modeling/linear_model/orthogonal_matching_pursuit.py +1 -0
- snowflake/ml/modeling/linear_model/passive_aggressive_classifier.py +1 -0
- snowflake/ml/modeling/linear_model/passive_aggressive_regressor.py +1 -0
- snowflake/ml/modeling/linear_model/perceptron.py +1 -0
- snowflake/ml/modeling/linear_model/poisson_regressor.py +1 -0
- snowflake/ml/modeling/linear_model/ransac_regressor.py +1 -0
- snowflake/ml/modeling/linear_model/ridge.py +1 -0
- snowflake/ml/modeling/linear_model/ridge_classifier.py +1 -0
- snowflake/ml/modeling/linear_model/ridge_classifier_cv.py +1 -0
- snowflake/ml/modeling/linear_model/ridge_cv.py +1 -0
- snowflake/ml/modeling/linear_model/sgd_classifier.py +1 -0
- snowflake/ml/modeling/linear_model/sgd_one_class_svm.py +1 -0
- snowflake/ml/modeling/linear_model/sgd_regressor.py +1 -0
- snowflake/ml/modeling/linear_model/theil_sen_regressor.py +1 -0
- snowflake/ml/modeling/linear_model/tweedie_regressor.py +1 -0
- snowflake/ml/modeling/manifold/isomap.py +1 -0
- snowflake/ml/modeling/manifold/mds.py +1 -0
- snowflake/ml/modeling/manifold/spectral_embedding.py +1 -0
- snowflake/ml/modeling/manifold/tsne.py +1 -0
- snowflake/ml/modeling/metrics/metrics_utils.py +2 -2
- snowflake/ml/modeling/metrics/ranking.py +0 -3
- snowflake/ml/modeling/metrics/regression.py +0 -3
- snowflake/ml/modeling/mixture/bayesian_gaussian_mixture.py +1 -0
- snowflake/ml/modeling/mixture/gaussian_mixture.py +1 -0
- snowflake/ml/modeling/multiclass/one_vs_one_classifier.py +1 -0
- snowflake/ml/modeling/multiclass/one_vs_rest_classifier.py +1 -0
- snowflake/ml/modeling/multiclass/output_code_classifier.py +1 -0
- snowflake/ml/modeling/naive_bayes/bernoulli_nb.py +1 -0
- snowflake/ml/modeling/naive_bayes/categorical_nb.py +1 -0
- snowflake/ml/modeling/naive_bayes/complement_nb.py +1 -0
- snowflake/ml/modeling/naive_bayes/gaussian_nb.py +1 -0
- snowflake/ml/modeling/naive_bayes/multinomial_nb.py +1 -0
- snowflake/ml/modeling/neighbors/k_neighbors_classifier.py +1 -0
- snowflake/ml/modeling/neighbors/k_neighbors_regressor.py +1 -0
- snowflake/ml/modeling/neighbors/kernel_density.py +1 -0
- snowflake/ml/modeling/neighbors/local_outlier_factor.py +1 -0
- snowflake/ml/modeling/neighbors/nearest_centroid.py +1 -0
- snowflake/ml/modeling/neighbors/nearest_neighbors.py +1 -0
- snowflake/ml/modeling/neighbors/neighborhood_components_analysis.py +1 -0
- snowflake/ml/modeling/neighbors/radius_neighbors_classifier.py +1 -0
- snowflake/ml/modeling/neighbors/radius_neighbors_regressor.py +1 -0
- snowflake/ml/modeling/neural_network/bernoulli_rbm.py +1 -0
- snowflake/ml/modeling/neural_network/mlp_classifier.py +1 -0
- snowflake/ml/modeling/neural_network/mlp_regressor.py +1 -0
- snowflake/ml/modeling/pipeline/pipeline.py +0 -1
- snowflake/ml/modeling/preprocessing/polynomial_features.py +1 -0
- snowflake/ml/modeling/semi_supervised/label_propagation.py +1 -0
- snowflake/ml/modeling/semi_supervised/label_spreading.py +1 -0
- snowflake/ml/modeling/svm/linear_svc.py +1 -0
- snowflake/ml/modeling/svm/linear_svr.py +1 -0
- snowflake/ml/modeling/svm/nu_svc.py +1 -0
- snowflake/ml/modeling/svm/nu_svr.py +1 -0
- snowflake/ml/modeling/svm/svc.py +1 -0
- snowflake/ml/modeling/svm/svr.py +1 -0
- snowflake/ml/modeling/tree/decision_tree_classifier.py +1 -0
- snowflake/ml/modeling/tree/decision_tree_regressor.py +1 -0
- snowflake/ml/modeling/tree/extra_tree_classifier.py +1 -0
- snowflake/ml/modeling/tree/extra_tree_regressor.py +1 -0
- snowflake/ml/modeling/xgboost/xgb_classifier.py +1 -0
- snowflake/ml/modeling/xgboost/xgb_regressor.py +1 -0
- snowflake/ml/modeling/xgboost/xgbrf_classifier.py +1 -0
- snowflake/ml/modeling/xgboost/xgbrf_regressor.py +1 -0
- snowflake/ml/monitoring/_client/model_monitor.py +126 -0
- snowflake/ml/monitoring/_client/model_monitor_manager.py +361 -0
- snowflake/ml/monitoring/_client/model_monitor_version.py +1 -0
- snowflake/ml/monitoring/_client/monitor_sql_client.py +1335 -0
- snowflake/ml/monitoring/_client/queries/record_count.ssql +14 -0
- snowflake/ml/monitoring/_client/queries/rmse.ssql +28 -0
- snowflake/ml/monitoring/entities/model_monitor_config.py +28 -0
- snowflake/ml/monitoring/entities/model_monitor_interval.py +46 -0
- snowflake/ml/monitoring/entities/output_score_type.py +90 -0
- snowflake/ml/registry/_manager/model_manager.py +4 -4
- snowflake/ml/registry/registry.py +165 -6
- snowflake/ml/version.py +1 -1
- {snowflake_ml_python-1.6.2.dist-info → snowflake_ml_python-1.6.3.dist-info}/METADATA +24 -9
- {snowflake_ml_python-1.6.2.dist-info → snowflake_ml_python-1.6.3.dist-info}/RECORD +225 -249
- {snowflake_ml_python-1.6.2.dist-info → snowflake_ml_python-1.6.3.dist-info}/WHEEL +1 -1
- snowflake/ml/_internal/container_services/image_registry/credential.py +0 -84
- snowflake/ml/_internal/container_services/image_registry/http_client.py +0 -127
- snowflake/ml/_internal/container_services/image_registry/imagelib.py +0 -400
- snowflake/ml/_internal/container_services/image_registry/registry_client.py +0 -212
- snowflake/ml/_internal/utils/log_stream_processor.py +0 -30
- snowflake/ml/_internal/utils/session_token_manager.py +0 -46
- snowflake/ml/_internal/utils/spcs_attribution_utils.py +0 -122
- snowflake/ml/_internal/utils/uri.py +0 -77
- snowflake/ml/model/_api.py +0 -568
- snowflake/ml/model/_deploy_client/image_builds/base_image_builder.py +0 -12
- snowflake/ml/model/_deploy_client/image_builds/client_image_builder.py +0 -249
- snowflake/ml/model/_deploy_client/image_builds/docker_context.py +0 -130
- snowflake/ml/model/_deploy_client/image_builds/gunicorn_run.sh +0 -36
- snowflake/ml/model/_deploy_client/image_builds/inference_server/main.py +0 -268
- snowflake/ml/model/_deploy_client/image_builds/server_image_builder.py +0 -215
- snowflake/ml/model/_deploy_client/image_builds/templates/dockerfile_template +0 -53
- snowflake/ml/model/_deploy_client/image_builds/templates/image_build_job_spec_template +0 -38
- snowflake/ml/model/_deploy_client/image_builds/templates/kaniko_shell_script_template +0 -105
- snowflake/ml/model/_deploy_client/snowservice/deploy.py +0 -611
- snowflake/ml/model/_deploy_client/snowservice/deploy_options.py +0 -116
- snowflake/ml/model/_deploy_client/snowservice/instance_types.py +0 -10
- snowflake/ml/model/_deploy_client/snowservice/templates/service_spec_template +0 -28
- snowflake/ml/model/_deploy_client/snowservice/templates/service_spec_template_with_model +0 -21
- snowflake/ml/model/_deploy_client/utils/constants.py +0 -48
- snowflake/ml/model/_deploy_client/utils/snowservice_client.py +0 -280
- snowflake/ml/model/_deploy_client/warehouse/deploy.py +0 -202
- snowflake/ml/model/_deploy_client/warehouse/infer_template.py +0 -99
- snowflake/ml/model/_packager/model_handlers/llm.py +0 -269
- snowflake/ml/model/_packager/model_meta/_core_requirements.py +0 -11
- snowflake/ml/model/deploy_platforms.py +0 -6
- snowflake/ml/model/models/llm.py +0 -106
- snowflake/ml/monitoring/monitor.py +0 -203
- snowflake/ml/registry/_initial_schema.py +0 -142
- snowflake/ml/registry/_schema.py +0 -82
- snowflake/ml/registry/_schema_upgrade_plans.py +0 -116
- snowflake/ml/registry/_schema_version_manager.py +0 -163
- snowflake/ml/registry/model_registry.py +0 -2048
- {snowflake_ml_python-1.6.2.dist-info → snowflake_ml_python-1.6.3.dist-info}/LICENSE.txt +0 -0
- {snowflake_ml_python-1.6.2.dist-info → snowflake_ml_python-1.6.3.dist-info}/top_level.txt +0 -0
snowflake/ml/model/_api.py
DELETED
@@ -1,568 +0,0 @@
|
|
1
|
-
from types import ModuleType
|
2
|
-
from typing import Any, Dict, List, Literal, Optional, Union, cast, overload
|
3
|
-
|
4
|
-
import pandas as pd
|
5
|
-
from typing_extensions import deprecated
|
6
|
-
|
7
|
-
from snowflake.ml._internal.exceptions import (
|
8
|
-
error_codes,
|
9
|
-
exceptions as snowml_exceptions,
|
10
|
-
)
|
11
|
-
from snowflake.ml.model import (
|
12
|
-
deploy_platforms,
|
13
|
-
model_signature,
|
14
|
-
type_hints as model_types,
|
15
|
-
)
|
16
|
-
from snowflake.ml.model._deploy_client.snowservice import deploy as snowservice_deploy
|
17
|
-
from snowflake.ml.model._deploy_client.utils import constants as snowservice_constants
|
18
|
-
from snowflake.ml.model._deploy_client.warehouse import (
|
19
|
-
deploy as warehouse_deploy,
|
20
|
-
infer_template,
|
21
|
-
)
|
22
|
-
from snowflake.ml.model._model_composer import model_composer
|
23
|
-
from snowflake.ml.model._signatures import snowpark_handler
|
24
|
-
from snowflake.snowpark import DataFrame as SnowparkDataFrame, Session, functions as F
|
25
|
-
|
26
|
-
|
27
|
-
@deprecated("Only used by PrPr model registry.")
|
28
|
-
@overload
|
29
|
-
def save_model(
|
30
|
-
*,
|
31
|
-
name: str,
|
32
|
-
model: model_types.SupportedNoSignatureRequirementsModelType,
|
33
|
-
session: Session,
|
34
|
-
stage_path: str,
|
35
|
-
metadata: Optional[Dict[str, str]] = None,
|
36
|
-
conda_dependencies: Optional[List[str]] = None,
|
37
|
-
pip_requirements: Optional[List[str]] = None,
|
38
|
-
python_version: Optional[str] = None,
|
39
|
-
ext_modules: Optional[List[ModuleType]] = None,
|
40
|
-
code_paths: Optional[List[str]] = None,
|
41
|
-
options: Optional[model_types.ModelSaveOption] = None,
|
42
|
-
) -> model_composer.ModelComposer:
|
43
|
-
"""Save a model that does not require a signature as model to a stage path.
|
44
|
-
|
45
|
-
Args:
|
46
|
-
name: Name of the model.
|
47
|
-
model: Model object.
|
48
|
-
session: Snowpark connection session.
|
49
|
-
stage_path: Path to the stage where model will be saved.
|
50
|
-
metadata: Model metadata.
|
51
|
-
conda_dependencies: List of Conda package specs. Use "[channel::]package [operator version]" syntax to specify
|
52
|
-
a dependency. It is a recommended way to specify your dependencies using conda. When channel is not
|
53
|
-
specified, defaults channel will be used. When deploying to Snowflake Warehouse, defaults channel would be
|
54
|
-
replaced with the Snowflake Anaconda channel.
|
55
|
-
pip_requirements: List of PIP package specs. Model will not be able to deploy to the warehouse if there is pip
|
56
|
-
requirements.
|
57
|
-
python_version: A string of python version where model is run. Used for user override. If specified as None,
|
58
|
-
current version would be captured. Defaults to None.
|
59
|
-
code_paths: Directory of code to import.
|
60
|
-
ext_modules: External modules that user might want to get pickled with model object. Defaults to None.
|
61
|
-
options: Model specific kwargs.
|
62
|
-
"""
|
63
|
-
...
|
64
|
-
|
65
|
-
|
66
|
-
@deprecated("Only used by PrPr model registry.")
|
67
|
-
@overload
|
68
|
-
def save_model(
|
69
|
-
*,
|
70
|
-
name: str,
|
71
|
-
model: model_types.SupportedRequireSignatureModelType,
|
72
|
-
session: Session,
|
73
|
-
stage_path: str,
|
74
|
-
signatures: Dict[str, model_signature.ModelSignature],
|
75
|
-
metadata: Optional[Dict[str, str]] = None,
|
76
|
-
conda_dependencies: Optional[List[str]] = None,
|
77
|
-
pip_requirements: Optional[List[str]] = None,
|
78
|
-
python_version: Optional[str] = None,
|
79
|
-
ext_modules: Optional[List[ModuleType]] = None,
|
80
|
-
code_paths: Optional[List[str]] = None,
|
81
|
-
options: Optional[model_types.ModelSaveOption] = None,
|
82
|
-
) -> model_composer.ModelComposer:
|
83
|
-
"""Save a model that requires a external signature with user provided signatures as model to a stage path.
|
84
|
-
|
85
|
-
Args:
|
86
|
-
name: Name of the model.
|
87
|
-
model: Model object.
|
88
|
-
session: Snowpark connection session.
|
89
|
-
stage_path: Path to the stage where model will be saved.
|
90
|
-
signatures: Model data signatures for inputs and output for every target methods.
|
91
|
-
metadata: Model metadata.
|
92
|
-
conda_dependencies: List of Conda package specs. Use "[channel::]package [operator version]" syntax to specify
|
93
|
-
a dependency. It is a recommended way to specify your dependencies using conda. When channel is not
|
94
|
-
specified, defaults channel will be used. When deploying to Snowflake Warehouse, defaults channel would be
|
95
|
-
replaced with the Snowflake Anaconda channel.
|
96
|
-
pip_requirements: List of PIP package specs. Model will not be able to deploy to the warehouse if there is pip
|
97
|
-
requirements.
|
98
|
-
python_version: A string of python version where model is run. Used for user override. If specified as None,
|
99
|
-
current version would be captured. Defaults to None.
|
100
|
-
code_paths: Directory of code to import.
|
101
|
-
ext_modules: External modules that user might want to get pickled with model object. Defaults to None.
|
102
|
-
options: Model specific kwargs.
|
103
|
-
"""
|
104
|
-
...
|
105
|
-
|
106
|
-
|
107
|
-
@deprecated("Only used by PrPr model registry.")
|
108
|
-
@overload
|
109
|
-
def save_model(
|
110
|
-
*,
|
111
|
-
name: str,
|
112
|
-
model: model_types.SupportedRequireSignatureModelType,
|
113
|
-
session: Session,
|
114
|
-
stage_path: str,
|
115
|
-
sample_input_data: model_types.SupportedDataType,
|
116
|
-
metadata: Optional[Dict[str, str]] = None,
|
117
|
-
conda_dependencies: Optional[List[str]] = None,
|
118
|
-
pip_requirements: Optional[List[str]] = None,
|
119
|
-
python_version: Optional[str] = None,
|
120
|
-
ext_modules: Optional[List[ModuleType]] = None,
|
121
|
-
code_paths: Optional[List[str]] = None,
|
122
|
-
options: Optional[model_types.ModelSaveOption] = None,
|
123
|
-
) -> model_composer.ModelComposer:
|
124
|
-
"""Save a model that requires a external signature as model to a stage path with signature inferred from a
|
125
|
-
sample_input_data.
|
126
|
-
|
127
|
-
Args:
|
128
|
-
name: Name of the model.
|
129
|
-
model: Model object.
|
130
|
-
session: Snowpark connection session.
|
131
|
-
stage_path: Path to the stage where model will be saved.
|
132
|
-
sample_input_data: Sample input data to infer the model signatures from.
|
133
|
-
metadata: Model metadata.
|
134
|
-
conda_dependencies: List of Conda package specs. Use "[channel::]package [operator version]" syntax to specify
|
135
|
-
a dependency. It is a recommended way to specify your dependencies using conda. When channel is not
|
136
|
-
specified, defaults channel will be used. When deploying to Snowflake Warehouse, defaults channel would be
|
137
|
-
replaced with the Snowflake Anaconda channel.
|
138
|
-
pip_requirements: List of PIP package specs. Model will not be able to deploy to the warehouse if there is pip
|
139
|
-
requirements.
|
140
|
-
python_version: A string of python version where model is run. Used for user override. If specified as None,
|
141
|
-
current version would be captured. Defaults to None.
|
142
|
-
code_paths: Directory of code to import.
|
143
|
-
ext_modules: External modules that user might want to get pickled with model object. Defaults to None.
|
144
|
-
options: Model specific kwargs.
|
145
|
-
"""
|
146
|
-
...
|
147
|
-
|
148
|
-
|
149
|
-
@deprecated("Only used by PrPr model registry.")
|
150
|
-
def save_model(
|
151
|
-
*,
|
152
|
-
name: str,
|
153
|
-
model: model_types.SupportedModelType,
|
154
|
-
session: Session,
|
155
|
-
stage_path: str,
|
156
|
-
signatures: Optional[Dict[str, model_signature.ModelSignature]] = None,
|
157
|
-
sample_input_data: Optional[model_types.SupportedDataType] = None,
|
158
|
-
metadata: Optional[Dict[str, str]] = None,
|
159
|
-
conda_dependencies: Optional[List[str]] = None,
|
160
|
-
pip_requirements: Optional[List[str]] = None,
|
161
|
-
python_version: Optional[str] = None,
|
162
|
-
ext_modules: Optional[List[ModuleType]] = None,
|
163
|
-
code_paths: Optional[List[str]] = None,
|
164
|
-
options: Optional[model_types.ModelSaveOption] = None,
|
165
|
-
) -> model_composer.ModelComposer:
|
166
|
-
"""Save the model.
|
167
|
-
|
168
|
-
Args:
|
169
|
-
name: Name of the model.
|
170
|
-
model: Model object.
|
171
|
-
session: Snowpark connection session.
|
172
|
-
stage_path: Path to the stage where model will be saved.
|
173
|
-
signatures: Model data signatures for inputs and output for every target methods. If it is None,
|
174
|
-
sample_input_data would be used to infer the signatures if it is a local (non-SnowML modeling model).
|
175
|
-
If not None, sample_input_data should not be specified. Defaults to None.
|
176
|
-
sample_input_data: Sample input data to infer the model signatures from. If it is None, signatures must be
|
177
|
-
specified if it is a local (non-SnowML modeling model). If not None, signatures should not be specified.
|
178
|
-
Defaults to None.
|
179
|
-
metadata: Model metadata.
|
180
|
-
conda_dependencies: List of Conda package specs. Use "[channel::]package [operator version]" syntax to specify
|
181
|
-
a dependency. It is a recommended way to specify your dependencies using conda. When channel is not
|
182
|
-
specified, defaults channel will be used. When deploying to Snowflake Warehouse, defaults channel would be
|
183
|
-
replaced with the Snowflake Anaconda channel.
|
184
|
-
pip_requirements: List of PIP package specs. Model will not be able to deploy to the warehouse if there is pip
|
185
|
-
requirements.
|
186
|
-
python_version: A string of python version where model is run. Used for user override. If specified as None,
|
187
|
-
current version would be captured. Defaults to None.
|
188
|
-
code_paths: Directory of code to import.
|
189
|
-
ext_modules: External modules that user might want to get pickled with model object. Defaults to None.
|
190
|
-
options: Model specific kwargs.
|
191
|
-
|
192
|
-
Returns:
|
193
|
-
Model
|
194
|
-
"""
|
195
|
-
if options is None:
|
196
|
-
options = {}
|
197
|
-
options["_legacy_save"] = True
|
198
|
-
|
199
|
-
m = model_composer.ModelComposer(session=session, stage_path=stage_path)
|
200
|
-
m.save(
|
201
|
-
name=name,
|
202
|
-
model=model,
|
203
|
-
signatures=signatures,
|
204
|
-
sample_input_data=sample_input_data,
|
205
|
-
metadata=metadata,
|
206
|
-
conda_dependencies=conda_dependencies,
|
207
|
-
pip_requirements=pip_requirements,
|
208
|
-
python_version=python_version,
|
209
|
-
ext_modules=ext_modules,
|
210
|
-
code_paths=code_paths,
|
211
|
-
options=options,
|
212
|
-
)
|
213
|
-
return m
|
214
|
-
|
215
|
-
|
216
|
-
@deprecated("Only used by PrPr model registry.")
|
217
|
-
@overload
|
218
|
-
def load_model(*, session: Session, stage_path: str) -> model_composer.ModelComposer:
|
219
|
-
"""Load the model into memory from a zip file in the stage.
|
220
|
-
|
221
|
-
Args:
|
222
|
-
session: Snowflake connection session.
|
223
|
-
stage_path: Path to the stage where model will be loaded from.
|
224
|
-
"""
|
225
|
-
...
|
226
|
-
|
227
|
-
|
228
|
-
@deprecated("Only used by PrPr model registry.")
|
229
|
-
@overload
|
230
|
-
def load_model(*, session: Session, stage_path: str, meta_only: Literal[False]) -> model_composer.ModelComposer:
|
231
|
-
"""Load the model into memory from a zip file in the stage.
|
232
|
-
|
233
|
-
Args:
|
234
|
-
session: Snowflake connection session.
|
235
|
-
stage_path: Path to the stage where model will be loaded from.
|
236
|
-
meta_only: Flag to indicate that if only load metadata.
|
237
|
-
"""
|
238
|
-
...
|
239
|
-
|
240
|
-
|
241
|
-
@deprecated("Only used by PrPr model registry.")
|
242
|
-
@overload
|
243
|
-
def load_model(*, session: Session, stage_path: str, meta_only: Literal[True]) -> model_composer.ModelComposer:
|
244
|
-
"""Load the model into memory from a zip file in the stage with metadata only.
|
245
|
-
|
246
|
-
Args:
|
247
|
-
session: Snowflake connection session.
|
248
|
-
stage_path: Path to the stage where model will be loaded from.
|
249
|
-
meta_only: Flag to indicate that if only load metadata.
|
250
|
-
"""
|
251
|
-
...
|
252
|
-
|
253
|
-
|
254
|
-
@deprecated("Only used by PrPr model registry.")
|
255
|
-
def load_model(
|
256
|
-
*,
|
257
|
-
session: Session,
|
258
|
-
stage_path: str,
|
259
|
-
meta_only: bool = False,
|
260
|
-
) -> model_composer.ModelComposer:
|
261
|
-
"""Load the model into memory from directory or a zip file in the stage.
|
262
|
-
|
263
|
-
Args:
|
264
|
-
session: Snowflake connection session. Must be specified when specifying model_stage_file_path.
|
265
|
-
Exclusive with model_dir_path.
|
266
|
-
stage_path: Path to the stage where model will be loaded from.
|
267
|
-
meta_only: Flag to indicate that if only load metadata.
|
268
|
-
|
269
|
-
Returns:
|
270
|
-
Loaded model.
|
271
|
-
"""
|
272
|
-
m = model_composer.ModelComposer(session=session, stage_path=stage_path)
|
273
|
-
m.legacy_load(meta_only=meta_only)
|
274
|
-
return m
|
275
|
-
|
276
|
-
|
277
|
-
@deprecated("Only used by PrPr model registry.")
|
278
|
-
@overload
|
279
|
-
def deploy(
|
280
|
-
session: Session,
|
281
|
-
*,
|
282
|
-
name: str,
|
283
|
-
platform: deploy_platforms.TargetPlatform,
|
284
|
-
target_method: Optional[str],
|
285
|
-
stage_path: str,
|
286
|
-
options: Optional[model_types.DeployOptions],
|
287
|
-
) -> Optional[model_types.Deployment]:
|
288
|
-
"""Create a deployment from a model in a zip file in a stage and deploy it to remote platform.
|
289
|
-
|
290
|
-
Args:
|
291
|
-
session: Snowpark Connection Session.
|
292
|
-
name: Name of the deployment for the model.
|
293
|
-
platform: Target platform to deploy the model.
|
294
|
-
target_method: The name of the target method to be deployed. Can be omitted if there is only 1 target method in
|
295
|
-
the model.
|
296
|
-
stage_path: Path to the stage where model will be deployed.
|
297
|
-
options: Additional options when deploying the model.
|
298
|
-
Each target platform will have their own specifications of options.
|
299
|
-
"""
|
300
|
-
...
|
301
|
-
|
302
|
-
|
303
|
-
@deprecated("Only used by PrPr model registry.")
|
304
|
-
@overload
|
305
|
-
def deploy(
|
306
|
-
session: Session,
|
307
|
-
*,
|
308
|
-
model_id: str,
|
309
|
-
name: str,
|
310
|
-
platform: deploy_platforms.TargetPlatform,
|
311
|
-
target_method: Optional[str],
|
312
|
-
stage_path: str,
|
313
|
-
deployment_stage_path: str,
|
314
|
-
options: Optional[model_types.DeployOptions],
|
315
|
-
) -> Optional[model_types.Deployment]:
|
316
|
-
"""Create a deployment from a model in a local directory and deploy it to remote platform.
|
317
|
-
|
318
|
-
Args:
|
319
|
-
session: Snowpark Connection Session.
|
320
|
-
model_id: Internal model ID string.
|
321
|
-
name: Name of the deployment for the model.
|
322
|
-
platform: Target platform to deploy the model.
|
323
|
-
target_method: The name of the target method to be deployed. Can be omitted if there is only 1 target method in
|
324
|
-
the model.
|
325
|
-
stage_path: Path to the stage where model will be deployed.
|
326
|
-
deployment_stage_path: Path to stage containing snowpark container service deployment artifacts.
|
327
|
-
options: Additional options when deploying the model.
|
328
|
-
Each target platform will have their own specifications of options.
|
329
|
-
"""
|
330
|
-
...
|
331
|
-
|
332
|
-
|
333
|
-
@deprecated("Only used by PrPr model registry.")
|
334
|
-
def deploy(
|
335
|
-
session: Session,
|
336
|
-
*,
|
337
|
-
name: str,
|
338
|
-
platform: deploy_platforms.TargetPlatform,
|
339
|
-
stage_path: str,
|
340
|
-
target_method: Optional[str] = None,
|
341
|
-
deployment_stage_path: Optional[str] = None,
|
342
|
-
model_id: Optional[str] = None,
|
343
|
-
options: Optional[model_types.DeployOptions],
|
344
|
-
) -> Optional[model_types.Deployment]:
|
345
|
-
"""Create a deployment from a model and deploy it to remote platform.
|
346
|
-
|
347
|
-
Args:
|
348
|
-
session: Snowpark Connection Session.
|
349
|
-
model_id: Internal model ID string.
|
350
|
-
name: Name of the deployment for the model.
|
351
|
-
platform: Target platform to deploy the model.
|
352
|
-
target_method: The name of the target method to be deployed. Can be omitted if there is only 1 target method in
|
353
|
-
the model.
|
354
|
-
stage_path: Path to the stage where model will be deployed.
|
355
|
-
deployment_stage_path: Path to stage containing deployment artifacts.
|
356
|
-
options: Additional options when deploying the model.
|
357
|
-
Each target platform will have their own specifications of options.
|
358
|
-
|
359
|
-
Raises:
|
360
|
-
SnowflakeMLException: Raised when target platform is unsupported.
|
361
|
-
SnowflakeMLException: Raised when target method does not exist in model.
|
362
|
-
|
363
|
-
Returns:
|
364
|
-
The deployment information.
|
365
|
-
"""
|
366
|
-
|
367
|
-
info = None
|
368
|
-
|
369
|
-
if not options:
|
370
|
-
options = {}
|
371
|
-
|
372
|
-
m = load_model(session=session, stage_path=stage_path, meta_only=True)
|
373
|
-
assert m.packager.meta
|
374
|
-
|
375
|
-
if target_method is None:
|
376
|
-
if len(m.packager.meta.signatures.keys()) == 1:
|
377
|
-
target_method = list(m.packager.meta.signatures.keys())[0]
|
378
|
-
else:
|
379
|
-
raise snowml_exceptions.SnowflakeMLException(
|
380
|
-
error_code=error_codes.INVALID_ARGUMENT,
|
381
|
-
original_exception=ValueError(
|
382
|
-
"Only when the model has 1 target methods can target_method be omitted when deploying."
|
383
|
-
),
|
384
|
-
)
|
385
|
-
|
386
|
-
details: model_types.DeployDetails = {}
|
387
|
-
if platform == deploy_platforms.TargetPlatform.WAREHOUSE:
|
388
|
-
warehouse_deploy._deploy_to_warehouse(
|
389
|
-
session=session,
|
390
|
-
model_stage_file_path=m.model_stage_path,
|
391
|
-
model_meta=m.packager.meta,
|
392
|
-
udf_name=name,
|
393
|
-
target_method=target_method,
|
394
|
-
**options,
|
395
|
-
)
|
396
|
-
|
397
|
-
elif platform == deploy_platforms.TargetPlatform.SNOWPARK_CONTAINER_SERVICES:
|
398
|
-
options = cast(model_types.SnowparkContainerServiceDeployOptions, options)
|
399
|
-
assert model_id, "Require 'model_id' for Snowpark container service deployment"
|
400
|
-
assert m.model_stage_path, "Require 'model_stage_file_path' for Snowpark container service deployment"
|
401
|
-
assert deployment_stage_path, "Require 'deployment_stage_path' for Snowpark container service deployment"
|
402
|
-
if snowservice_constants.COMPUTE_POOL not in options:
|
403
|
-
raise snowml_exceptions.SnowflakeMLException(
|
404
|
-
error_code=error_codes.INVALID_ARGUMENT,
|
405
|
-
original_exception=ValueError(
|
406
|
-
"Missing 'compute_pool' in options field for Snowpark container service deployment"
|
407
|
-
),
|
408
|
-
)
|
409
|
-
|
410
|
-
details = snowservice_deploy._deploy(
|
411
|
-
session=session,
|
412
|
-
model_id=model_id,
|
413
|
-
model_meta=m.packager.meta,
|
414
|
-
service_func_name=name,
|
415
|
-
model_zip_stage_path=m.model_stage_path,
|
416
|
-
deployment_stage_path=deployment_stage_path,
|
417
|
-
target_method=target_method,
|
418
|
-
**options,
|
419
|
-
)
|
420
|
-
|
421
|
-
else:
|
422
|
-
raise snowml_exceptions.SnowflakeMLException(
|
423
|
-
error_code=error_codes.INVALID_TYPE,
|
424
|
-
original_exception=ValueError(f"Unsupported target Platform: {platform}"),
|
425
|
-
)
|
426
|
-
signature = m.packager.meta.signatures.get(target_method, None)
|
427
|
-
if not signature:
|
428
|
-
raise snowml_exceptions.SnowflakeMLException(
|
429
|
-
error_code=error_codes.INVALID_ARGUMENT,
|
430
|
-
original_exception=ValueError(f"Target method {target_method} does not exist in model."),
|
431
|
-
)
|
432
|
-
info = model_types.Deployment(
|
433
|
-
name=name, platform=platform, target_method=target_method, signature=signature, options=options, details=details
|
434
|
-
)
|
435
|
-
return info
|
436
|
-
|
437
|
-
|
438
|
-
@deprecated("Only used by PrPr model registry.")
|
439
|
-
@overload
|
440
|
-
def predict(
|
441
|
-
session: Session,
|
442
|
-
*,
|
443
|
-
deployment: model_types.Deployment,
|
444
|
-
X: model_types.SupportedLocalDataType,
|
445
|
-
statement_params: Optional[Dict[str, Any]] = None,
|
446
|
-
) -> pd.DataFrame:
|
447
|
-
"""Execute batch inference of a model remotely on local data. Can be any supported data type. Return a local
|
448
|
-
Pandas Dataframe.
|
449
|
-
|
450
|
-
Args:
|
451
|
-
session: Snowpark Connection Session.
|
452
|
-
deployment: The deployment info to use for predict.
|
453
|
-
X: The input data.
|
454
|
-
statement_params: Statement Parameters for telemetry.
|
455
|
-
"""
|
456
|
-
...
|
457
|
-
|
458
|
-
|
459
|
-
@deprecated("Only used by PrPr model registry.")
|
460
|
-
@overload
|
461
|
-
def predict(
|
462
|
-
session: Session,
|
463
|
-
*,
|
464
|
-
deployment: model_types.Deployment,
|
465
|
-
X: SnowparkDataFrame,
|
466
|
-
statement_params: Optional[Dict[str, Any]] = None,
|
467
|
-
) -> SnowparkDataFrame:
|
468
|
-
"""Execute batch inference of a model remotely on a Snowpark DataFrame. Return a Snowpark DataFrame.
|
469
|
-
|
470
|
-
Args:
|
471
|
-
session: Snowpark Connection Session.
|
472
|
-
deployment: The deployment info to use for predict.
|
473
|
-
X: The input Snowpark dataframe.
|
474
|
-
statement_params: Statement Parameters for telemetry.
|
475
|
-
"""
|
476
|
-
...
|
477
|
-
|
478
|
-
|
479
|
-
@deprecated("Only used by PrPr model registry.")
|
480
|
-
def predict(
|
481
|
-
session: Session,
|
482
|
-
*,
|
483
|
-
deployment: model_types.Deployment,
|
484
|
-
X: Union[model_types.SupportedDataType, SnowparkDataFrame],
|
485
|
-
statement_params: Optional[Dict[str, Any]] = None,
|
486
|
-
) -> Union[pd.DataFrame, SnowparkDataFrame]:
|
487
|
-
"""Execute batch inference of a model remotely.
|
488
|
-
|
489
|
-
Args:
|
490
|
-
session: Snowpark Connection Session.
|
491
|
-
deployment: The deployment info to use for predict.
|
492
|
-
X: The input dataframe.
|
493
|
-
statement_params: Statement Parameters for telemetry.
|
494
|
-
|
495
|
-
Returns:
|
496
|
-
The output dataframe.
|
497
|
-
"""
|
498
|
-
|
499
|
-
# Get options
|
500
|
-
INTERMEDIATE_OBJ_NAME = "tmp_result"
|
501
|
-
sig = deployment["signature"]
|
502
|
-
identifier_rule = model_signature.SnowparkIdentifierRule.INFERRED
|
503
|
-
|
504
|
-
# Validate and prepare input
|
505
|
-
if not isinstance(X, SnowparkDataFrame):
|
506
|
-
keep_order = True
|
507
|
-
output_with_input_features = False
|
508
|
-
df = model_signature._convert_and_validate_local_data(X, sig.inputs)
|
509
|
-
s_df = snowpark_handler.SnowparkDataFrameHandler.convert_from_df(
|
510
|
-
session, df, keep_order=keep_order, features=sig.inputs
|
511
|
-
)
|
512
|
-
else:
|
513
|
-
keep_order = False
|
514
|
-
output_with_input_features = True
|
515
|
-
identifier_rule = model_signature._validate_snowpark_data(X, sig.inputs)
|
516
|
-
s_df = X
|
517
|
-
|
518
|
-
if statement_params:
|
519
|
-
if s_df._statement_params is not None:
|
520
|
-
s_df._statement_params.update(statement_params)
|
521
|
-
else:
|
522
|
-
s_df._statement_params = statement_params # type: ignore[assignment]
|
523
|
-
|
524
|
-
original_cols = s_df.columns
|
525
|
-
|
526
|
-
# Infer and get intermediate result
|
527
|
-
input_cols = []
|
528
|
-
for input_feature in sig.inputs:
|
529
|
-
literal_col_name = input_feature.name
|
530
|
-
col_name = identifier_rule.get_identifier_from_feature(input_feature.name)
|
531
|
-
|
532
|
-
input_cols.extend(
|
533
|
-
[
|
534
|
-
F.lit(literal_col_name),
|
535
|
-
F.col(col_name),
|
536
|
-
]
|
537
|
-
)
|
538
|
-
|
539
|
-
udf_name = deployment["name"]
|
540
|
-
output_obj = F.call_udf(udf_name, F.object_construct_keep_null(*input_cols))
|
541
|
-
df_res = s_df.with_column(INTERMEDIATE_OBJ_NAME, output_obj)
|
542
|
-
|
543
|
-
if keep_order:
|
544
|
-
df_res = df_res.order_by(
|
545
|
-
F.col(infer_template._KEEP_ORDER_COL_NAME),
|
546
|
-
ascending=True,
|
547
|
-
)
|
548
|
-
|
549
|
-
if not output_with_input_features:
|
550
|
-
df_res = df_res.drop(*original_cols)
|
551
|
-
|
552
|
-
# Prepare the output
|
553
|
-
output_cols = []
|
554
|
-
output_col_names = []
|
555
|
-
for output_feature in sig.outputs:
|
556
|
-
output_cols.append(F.col(INTERMEDIATE_OBJ_NAME)[output_feature.name].astype(output_feature.as_snowpark_type()))
|
557
|
-
output_col_names.append(identifier_rule.get_identifier_from_feature(output_feature.name))
|
558
|
-
|
559
|
-
df_res = df_res.with_columns(
|
560
|
-
output_col_names,
|
561
|
-
output_cols,
|
562
|
-
).drop(INTERMEDIATE_OBJ_NAME)
|
563
|
-
|
564
|
-
# Get final result
|
565
|
-
if not isinstance(X, SnowparkDataFrame):
|
566
|
-
return snowpark_handler.SnowparkDataFrameHandler.convert_to_df(df_res, features=sig.outputs)
|
567
|
-
else:
|
568
|
-
return df_res
|
@@ -1,12 +0,0 @@
|
|
1
|
-
from abc import ABC, abstractmethod
|
2
|
-
|
3
|
-
|
4
|
-
class ImageBuilder(ABC):
|
5
|
-
"""
|
6
|
-
Abstract class encapsulating image building and upload to model registry.
|
7
|
-
"""
|
8
|
-
|
9
|
-
@abstractmethod
|
10
|
-
def build_and_upload_image(self) -> None:
|
11
|
-
"""Builds and uploads an image to the model registry."""
|
12
|
-
pass
|