snowflake-ml-python 1.4.1__py3-none-any.whl → 1.5.0__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.
Files changed (206) hide show
  1. snowflake/ml/_internal/env_utils.py +66 -31
  2. snowflake/ml/_internal/exceptions/dataset_error_messages.py +5 -0
  3. snowflake/ml/_internal/exceptions/dataset_errors.py +24 -0
  4. snowflake/ml/_internal/exceptions/error_codes.py +3 -0
  5. snowflake/ml/_internal/lineage/data_source.py +10 -0
  6. snowflake/ml/_internal/lineage/dataset_dataframe.py +44 -0
  7. snowflake/ml/dataset/__init__.py +10 -0
  8. snowflake/ml/dataset/dataset.py +454 -129
  9. snowflake/ml/dataset/dataset_factory.py +53 -0
  10. snowflake/ml/dataset/dataset_metadata.py +103 -0
  11. snowflake/ml/dataset/dataset_reader.py +202 -0
  12. snowflake/ml/feature_store/feature_store.py +408 -282
  13. snowflake/ml/feature_store/feature_view.py +37 -8
  14. snowflake/ml/fileset/embedded_stage_fs.py +146 -0
  15. snowflake/ml/fileset/sfcfs.py +0 -4
  16. snowflake/ml/fileset/snowfs.py +159 -0
  17. snowflake/ml/fileset/stage_fs.py +1 -4
  18. snowflake/ml/model/__init__.py +2 -2
  19. snowflake/ml/model/_api.py +16 -1
  20. snowflake/ml/model/_client/model/model_impl.py +27 -0
  21. snowflake/ml/model/_client/model/model_version_impl.py +135 -0
  22. snowflake/ml/model/_client/ops/model_ops.py +137 -67
  23. snowflake/ml/model/_client/sql/model.py +16 -14
  24. snowflake/ml/model/_client/sql/model_version.py +109 -1
  25. snowflake/ml/model/_deploy_client/image_builds/server_image_builder.py +5 -1
  26. snowflake/ml/model/_deploy_client/image_builds/templates/dockerfile_template +1 -0
  27. snowflake/ml/model/_deploy_client/snowservice/deploy.py +2 -0
  28. snowflake/ml/model/_deploy_client/utils/constants.py +0 -5
  29. snowflake/ml/model/_deploy_client/utils/snowservice_client.py +21 -50
  30. snowflake/ml/model/_model_composer/model_composer.py +22 -1
  31. snowflake/ml/model/_model_composer/model_manifest/model_manifest.py +22 -0
  32. snowflake/ml/model/_model_composer/model_manifest/model_manifest_schema.py +11 -0
  33. snowflake/ml/model/_packager/model_env/model_env.py +41 -0
  34. snowflake/ml/model/_packager/model_meta/model_meta.py +1 -5
  35. snowflake/ml/model/_packager/model_packager.py +0 -3
  36. snowflake/ml/modeling/_internal/local_implementations/pandas_trainer.py +55 -3
  37. snowflake/ml/modeling/_internal/ml_runtime_implementations/ml_runtime_handlers.py +34 -18
  38. snowflake/ml/modeling/_internal/model_trainer.py +7 -0
  39. snowflake/ml/modeling/_internal/model_trainer_builder.py +42 -9
  40. snowflake/ml/modeling/_internal/snowpark_implementations/snowpark_handlers.py +24 -2
  41. snowflake/ml/modeling/_internal/snowpark_implementations/snowpark_trainer.py +261 -16
  42. snowflake/ml/modeling/calibration/calibrated_classifier_cv.py +51 -52
  43. snowflake/ml/modeling/cluster/affinity_propagation.py +51 -52
  44. snowflake/ml/modeling/cluster/agglomerative_clustering.py +51 -52
  45. snowflake/ml/modeling/cluster/birch.py +53 -52
  46. snowflake/ml/modeling/cluster/bisecting_k_means.py +53 -52
  47. snowflake/ml/modeling/cluster/dbscan.py +51 -52
  48. snowflake/ml/modeling/cluster/feature_agglomeration.py +53 -52
  49. snowflake/ml/modeling/cluster/k_means.py +53 -52
  50. snowflake/ml/modeling/cluster/mean_shift.py +51 -52
  51. snowflake/ml/modeling/cluster/mini_batch_k_means.py +53 -52
  52. snowflake/ml/modeling/cluster/optics.py +51 -52
  53. snowflake/ml/modeling/cluster/spectral_biclustering.py +51 -52
  54. snowflake/ml/modeling/cluster/spectral_clustering.py +51 -52
  55. snowflake/ml/modeling/cluster/spectral_coclustering.py +51 -52
  56. snowflake/ml/modeling/compose/column_transformer.py +53 -52
  57. snowflake/ml/modeling/compose/transformed_target_regressor.py +51 -52
  58. snowflake/ml/modeling/covariance/elliptic_envelope.py +51 -52
  59. snowflake/ml/modeling/covariance/empirical_covariance.py +51 -52
  60. snowflake/ml/modeling/covariance/graphical_lasso.py +51 -52
  61. snowflake/ml/modeling/covariance/graphical_lasso_cv.py +51 -52
  62. snowflake/ml/modeling/covariance/ledoit_wolf.py +51 -52
  63. snowflake/ml/modeling/covariance/min_cov_det.py +51 -52
  64. snowflake/ml/modeling/covariance/oas.py +51 -52
  65. snowflake/ml/modeling/covariance/shrunk_covariance.py +51 -52
  66. snowflake/ml/modeling/decomposition/dictionary_learning.py +53 -52
  67. snowflake/ml/modeling/decomposition/factor_analysis.py +53 -52
  68. snowflake/ml/modeling/decomposition/fast_ica.py +53 -52
  69. snowflake/ml/modeling/decomposition/incremental_pca.py +53 -52
  70. snowflake/ml/modeling/decomposition/kernel_pca.py +53 -52
  71. snowflake/ml/modeling/decomposition/mini_batch_dictionary_learning.py +53 -52
  72. snowflake/ml/modeling/decomposition/mini_batch_sparse_pca.py +53 -52
  73. snowflake/ml/modeling/decomposition/pca.py +53 -52
  74. snowflake/ml/modeling/decomposition/sparse_pca.py +53 -52
  75. snowflake/ml/modeling/decomposition/truncated_svd.py +53 -52
  76. snowflake/ml/modeling/discriminant_analysis/linear_discriminant_analysis.py +53 -52
  77. snowflake/ml/modeling/discriminant_analysis/quadratic_discriminant_analysis.py +51 -52
  78. snowflake/ml/modeling/ensemble/ada_boost_classifier.py +51 -52
  79. snowflake/ml/modeling/ensemble/ada_boost_regressor.py +51 -52
  80. snowflake/ml/modeling/ensemble/bagging_classifier.py +51 -52
  81. snowflake/ml/modeling/ensemble/bagging_regressor.py +51 -52
  82. snowflake/ml/modeling/ensemble/extra_trees_classifier.py +51 -52
  83. snowflake/ml/modeling/ensemble/extra_trees_regressor.py +51 -52
  84. snowflake/ml/modeling/ensemble/gradient_boosting_classifier.py +51 -52
  85. snowflake/ml/modeling/ensemble/gradient_boosting_regressor.py +51 -52
  86. snowflake/ml/modeling/ensemble/hist_gradient_boosting_classifier.py +51 -52
  87. snowflake/ml/modeling/ensemble/hist_gradient_boosting_regressor.py +51 -52
  88. snowflake/ml/modeling/ensemble/isolation_forest.py +51 -52
  89. snowflake/ml/modeling/ensemble/random_forest_classifier.py +51 -52
  90. snowflake/ml/modeling/ensemble/random_forest_regressor.py +51 -52
  91. snowflake/ml/modeling/ensemble/stacking_regressor.py +53 -52
  92. snowflake/ml/modeling/ensemble/voting_classifier.py +53 -52
  93. snowflake/ml/modeling/ensemble/voting_regressor.py +53 -52
  94. snowflake/ml/modeling/feature_selection/generic_univariate_select.py +53 -52
  95. snowflake/ml/modeling/feature_selection/select_fdr.py +53 -52
  96. snowflake/ml/modeling/feature_selection/select_fpr.py +53 -52
  97. snowflake/ml/modeling/feature_selection/select_fwe.py +53 -52
  98. snowflake/ml/modeling/feature_selection/select_k_best.py +53 -52
  99. snowflake/ml/modeling/feature_selection/select_percentile.py +53 -52
  100. snowflake/ml/modeling/feature_selection/sequential_feature_selector.py +53 -52
  101. snowflake/ml/modeling/feature_selection/variance_threshold.py +53 -52
  102. snowflake/ml/modeling/framework/base.py +63 -36
  103. snowflake/ml/modeling/gaussian_process/gaussian_process_classifier.py +51 -52
  104. snowflake/ml/modeling/gaussian_process/gaussian_process_regressor.py +51 -52
  105. snowflake/ml/modeling/impute/iterative_imputer.py +53 -52
  106. snowflake/ml/modeling/impute/knn_imputer.py +53 -52
  107. snowflake/ml/modeling/impute/missing_indicator.py +53 -52
  108. snowflake/ml/modeling/kernel_approximation/additive_chi2_sampler.py +53 -52
  109. snowflake/ml/modeling/kernel_approximation/nystroem.py +53 -52
  110. snowflake/ml/modeling/kernel_approximation/polynomial_count_sketch.py +53 -52
  111. snowflake/ml/modeling/kernel_approximation/rbf_sampler.py +53 -52
  112. snowflake/ml/modeling/kernel_approximation/skewed_chi2_sampler.py +53 -52
  113. snowflake/ml/modeling/kernel_ridge/kernel_ridge.py +51 -52
  114. snowflake/ml/modeling/lightgbm/lgbm_classifier.py +51 -52
  115. snowflake/ml/modeling/lightgbm/lgbm_regressor.py +51 -52
  116. snowflake/ml/modeling/linear_model/ard_regression.py +51 -52
  117. snowflake/ml/modeling/linear_model/bayesian_ridge.py +51 -52
  118. snowflake/ml/modeling/linear_model/elastic_net.py +51 -52
  119. snowflake/ml/modeling/linear_model/elastic_net_cv.py +51 -52
  120. snowflake/ml/modeling/linear_model/gamma_regressor.py +51 -52
  121. snowflake/ml/modeling/linear_model/huber_regressor.py +51 -52
  122. snowflake/ml/modeling/linear_model/lars.py +51 -52
  123. snowflake/ml/modeling/linear_model/lars_cv.py +51 -52
  124. snowflake/ml/modeling/linear_model/lasso.py +51 -52
  125. snowflake/ml/modeling/linear_model/lasso_cv.py +51 -52
  126. snowflake/ml/modeling/linear_model/lasso_lars.py +51 -52
  127. snowflake/ml/modeling/linear_model/lasso_lars_cv.py +51 -52
  128. snowflake/ml/modeling/linear_model/lasso_lars_ic.py +51 -52
  129. snowflake/ml/modeling/linear_model/linear_regression.py +51 -52
  130. snowflake/ml/modeling/linear_model/logistic_regression.py +51 -52
  131. snowflake/ml/modeling/linear_model/logistic_regression_cv.py +51 -52
  132. snowflake/ml/modeling/linear_model/multi_task_elastic_net.py +51 -52
  133. snowflake/ml/modeling/linear_model/multi_task_elastic_net_cv.py +51 -52
  134. snowflake/ml/modeling/linear_model/multi_task_lasso.py +51 -52
  135. snowflake/ml/modeling/linear_model/multi_task_lasso_cv.py +51 -52
  136. snowflake/ml/modeling/linear_model/orthogonal_matching_pursuit.py +51 -52
  137. snowflake/ml/modeling/linear_model/passive_aggressive_classifier.py +51 -52
  138. snowflake/ml/modeling/linear_model/passive_aggressive_regressor.py +51 -52
  139. snowflake/ml/modeling/linear_model/perceptron.py +51 -52
  140. snowflake/ml/modeling/linear_model/poisson_regressor.py +51 -52
  141. snowflake/ml/modeling/linear_model/ransac_regressor.py +51 -52
  142. snowflake/ml/modeling/linear_model/ridge.py +51 -52
  143. snowflake/ml/modeling/linear_model/ridge_classifier.py +51 -52
  144. snowflake/ml/modeling/linear_model/ridge_classifier_cv.py +51 -52
  145. snowflake/ml/modeling/linear_model/ridge_cv.py +51 -52
  146. snowflake/ml/modeling/linear_model/sgd_classifier.py +51 -52
  147. snowflake/ml/modeling/linear_model/sgd_one_class_svm.py +51 -52
  148. snowflake/ml/modeling/linear_model/sgd_regressor.py +51 -52
  149. snowflake/ml/modeling/linear_model/theil_sen_regressor.py +51 -52
  150. snowflake/ml/modeling/linear_model/tweedie_regressor.py +51 -52
  151. snowflake/ml/modeling/manifold/isomap.py +53 -52
  152. snowflake/ml/modeling/manifold/mds.py +53 -52
  153. snowflake/ml/modeling/manifold/spectral_embedding.py +53 -52
  154. snowflake/ml/modeling/manifold/tsne.py +53 -52
  155. snowflake/ml/modeling/mixture/bayesian_gaussian_mixture.py +51 -52
  156. snowflake/ml/modeling/mixture/gaussian_mixture.py +51 -52
  157. snowflake/ml/modeling/model_selection/grid_search_cv.py +21 -23
  158. snowflake/ml/modeling/model_selection/randomized_search_cv.py +38 -20
  159. snowflake/ml/modeling/multiclass/one_vs_one_classifier.py +51 -52
  160. snowflake/ml/modeling/multiclass/one_vs_rest_classifier.py +51 -52
  161. snowflake/ml/modeling/multiclass/output_code_classifier.py +51 -52
  162. snowflake/ml/modeling/naive_bayes/bernoulli_nb.py +51 -52
  163. snowflake/ml/modeling/naive_bayes/categorical_nb.py +51 -52
  164. snowflake/ml/modeling/naive_bayes/complement_nb.py +51 -52
  165. snowflake/ml/modeling/naive_bayes/gaussian_nb.py +51 -52
  166. snowflake/ml/modeling/naive_bayes/multinomial_nb.py +51 -52
  167. snowflake/ml/modeling/neighbors/k_neighbors_classifier.py +51 -52
  168. snowflake/ml/modeling/neighbors/k_neighbors_regressor.py +51 -52
  169. snowflake/ml/modeling/neighbors/kernel_density.py +51 -52
  170. snowflake/ml/modeling/neighbors/local_outlier_factor.py +51 -52
  171. snowflake/ml/modeling/neighbors/nearest_centroid.py +51 -52
  172. snowflake/ml/modeling/neighbors/nearest_neighbors.py +51 -52
  173. snowflake/ml/modeling/neighbors/neighborhood_components_analysis.py +53 -52
  174. snowflake/ml/modeling/neighbors/radius_neighbors_classifier.py +51 -52
  175. snowflake/ml/modeling/neighbors/radius_neighbors_regressor.py +51 -52
  176. snowflake/ml/modeling/neural_network/bernoulli_rbm.py +53 -52
  177. snowflake/ml/modeling/neural_network/mlp_classifier.py +51 -52
  178. snowflake/ml/modeling/neural_network/mlp_regressor.py +51 -52
  179. snowflake/ml/modeling/pipeline/pipeline.py +514 -32
  180. snowflake/ml/modeling/preprocessing/one_hot_encoder.py +12 -0
  181. snowflake/ml/modeling/preprocessing/polynomial_features.py +53 -52
  182. snowflake/ml/modeling/semi_supervised/label_propagation.py +51 -52
  183. snowflake/ml/modeling/semi_supervised/label_spreading.py +51 -52
  184. snowflake/ml/modeling/svm/linear_svc.py +51 -52
  185. snowflake/ml/modeling/svm/linear_svr.py +51 -52
  186. snowflake/ml/modeling/svm/nu_svc.py +51 -52
  187. snowflake/ml/modeling/svm/nu_svr.py +51 -52
  188. snowflake/ml/modeling/svm/svc.py +51 -52
  189. snowflake/ml/modeling/svm/svr.py +51 -52
  190. snowflake/ml/modeling/tree/decision_tree_classifier.py +51 -52
  191. snowflake/ml/modeling/tree/decision_tree_regressor.py +51 -52
  192. snowflake/ml/modeling/tree/extra_tree_classifier.py +51 -52
  193. snowflake/ml/modeling/tree/extra_tree_regressor.py +51 -52
  194. snowflake/ml/modeling/xgboost/xgb_classifier.py +51 -52
  195. snowflake/ml/modeling/xgboost/xgb_regressor.py +51 -52
  196. snowflake/ml/modeling/xgboost/xgbrf_classifier.py +51 -52
  197. snowflake/ml/modeling/xgboost/xgbrf_regressor.py +51 -52
  198. snowflake/ml/registry/model_registry.py +3 -149
  199. snowflake/ml/version.py +1 -1
  200. {snowflake_ml_python-1.4.1.dist-info → snowflake_ml_python-1.5.0.dist-info}/METADATA +63 -2
  201. {snowflake_ml_python-1.4.1.dist-info → snowflake_ml_python-1.5.0.dist-info}/RECORD +204 -196
  202. snowflake/ml/registry/_artifact_manager.py +0 -156
  203. snowflake/ml/registry/artifact.py +0 -46
  204. {snowflake_ml_python-1.4.1.dist-info → snowflake_ml_python-1.5.0.dist-info}/LICENSE.txt +0 -0
  205. {snowflake_ml_python-1.4.1.dist-info → snowflake_ml_python-1.5.0.dist-info}/WHEEL +0 -0
  206. {snowflake_ml_python-1.4.1.dist-info → snowflake_ml_python-1.5.0.dist-info}/top_level.txt +0 -0
@@ -29,19 +29,13 @@ from snowflake.ml._internal.utils import (
29
29
  table_manager,
30
30
  uri,
31
31
  )
32
- from snowflake.ml.dataset import dataset
33
32
  from snowflake.ml.model import (
34
33
  _api as model_api,
35
34
  deploy_platforms,
36
35
  model_signature,
37
36
  type_hints as model_types,
38
37
  )
39
- from snowflake.ml.registry import (
40
- _artifact_manager,
41
- _initial_schema,
42
- _schema_version_manager,
43
- artifact,
44
- )
38
+ from snowflake.ml.registry import _initial_schema, _schema_version_manager
45
39
  from snowflake.snowpark._internal import utils as snowpark_utils
46
40
 
47
41
  if TYPE_CHECKING:
@@ -142,7 +136,6 @@ def _create_registry_views(
142
136
  registry_table_name: str,
143
137
  metadata_table_name: str,
144
138
  deployment_table_name: str,
145
- artifact_table_name: str,
146
139
  statement_params: Dict[str, Any],
147
140
  ) -> None:
148
141
  """Create views on underlying ModelRegistry tables.
@@ -154,7 +147,6 @@ def _create_registry_views(
154
147
  registry_table_name: Name for the main model registry table.
155
148
  metadata_table_name: Name for the metadata table used by the model registry.
156
149
  deployment_table_name: Name for the deployment event table.
157
- artifact_table_name: Name for the artifact table.
158
150
  statement_params: Function usage statement parameters used in sql query executions.
159
151
  """
160
152
  fully_qualified_schema_name = table_manager.get_fully_qualified_schema_name(database_name, schema_name)
@@ -235,23 +227,6 @@ def _create_registry_views(
235
227
  FROM {registry_table_name} {metadata_views_join}"""
236
228
  ).collect(statement_params=statement_params)
237
229
 
238
- # Create artifact view. it joins artifact tables with registry table on model id.
239
- artifact_view_name = identifier.concat_names([artifact_table_name, "_VIEW"])
240
- session.sql(
241
- f"""CREATE OR REPLACE TEMPORARY VIEW {fully_qualified_schema_name}.{artifact_view_name} COPY GRANTS AS
242
- SELECT
243
- {registry_table_name}.NAME AS MODEL_NAME,
244
- {registry_table_name}.VERSION AS MODEL_VERSION,
245
- {artifact_table_name}.*
246
- FROM {registry_table_name}
247
- LEFT JOIN {artifact_table_name}
248
- ON (ARRAY_CONTAINS(
249
- {artifact_table_name}.ID::VARIANT,
250
- {registry_table_name}.ARTIFACT_IDS)
251
- )
252
- """
253
- ).collect(statement_params=statement_params)
254
-
255
230
 
256
231
  def _create_active_permanent_deployment_view(
257
232
  session: snowpark.Session,
@@ -337,11 +312,8 @@ fully integrated into the new registry.
337
312
  self._deployment_table = identifier.get_inferred_name(_DEPLOYMENT_TABLE_NAME)
338
313
  self._permanent_deployment_view = identifier.concat_names([self._deployment_table, "_VIEW"])
339
314
  self._permanent_deployment_stage = identifier.concat_names([self._deployment_table, "_STAGE"])
340
- self._artifact_table = identifier.get_inferred_name(_initial_schema._ARTIFACT_TABLE_NAME)
341
- self._artifact_view = identifier.concat_names([self._artifact_table, "_VIEW"])
342
315
  self._session = session
343
316
  self._svm = _schema_version_manager.SchemaVersionManager(self._session, self._name, self._schema)
344
- self._artifact_manager = _artifact_manager.ArtifactManager(self._session, self._name, self._schema)
345
317
 
346
318
  # A in-memory deployment info cache to store information of temporary deployments
347
319
  # TODO(zhe): Use a temporary table to replace the in-memory cache.
@@ -359,7 +331,6 @@ fully integrated into the new registry.
359
331
  self._registry_table,
360
332
  self._metadata_table,
361
333
  self._deployment_table,
362
- self._artifact_table,
363
334
  statement_params,
364
335
  )
365
336
 
@@ -399,9 +370,6 @@ fully integrated into the new registry.
399
370
  """Get the fully qualified name to the permanent deployment view."""
400
371
  return table_manager.get_fully_qualified_table_name(self._name, self._schema, self._permanent_deployment_view)
401
372
 
402
- def _fully_qualified_artifact_view_name(self) -> str:
403
- return table_manager.get_fully_qualified_table_name(self._name, self._schema, self._artifact_view)
404
-
405
373
  def _fully_qualified_schema_name(self) -> str:
406
374
  """Get the fully qualified name to the current registry schema."""
407
375
  return table_manager.get_fully_qualified_schema_name(self._name, self._schema)
@@ -858,7 +826,6 @@ fully integrated into the new registry.
858
826
  output_spec: Optional[Dict[str, str]] = None,
859
827
  description: Optional[str] = None,
860
828
  tags: Optional[Dict[str, str]] = None,
861
- artifacts: Optional[List[artifact.Artifact]] = None,
862
829
  ) -> None:
863
830
  """Helper function to register model metadata.
864
831
 
@@ -878,10 +845,8 @@ fully integrated into the new registry.
878
845
  description: A description for the model. The description can be changed later.
879
846
  tags: Key-value pairs of tags to be set for this model. Tags can be modified
880
847
  after model registration.
881
- artifacts: A list of artifact references.
882
848
 
883
849
  Raises:
884
- ValueError: Artifact ids not found in model registry.
885
850
  DataError: The given model already exists.
886
851
  DatabaseError: Unable to register the model properties into table.
887
852
  """
@@ -897,12 +862,6 @@ fully integrated into the new registry.
897
862
  new_model["CREATION_ROLE"] = self._session.get_current_role()
898
863
  new_model["CREATION_ENVIRONMENT_SPEC"] = {"python": ".".join(map(str, sys.version_info[:3]))}
899
864
 
900
- if artifacts is not None:
901
- for atf in artifacts:
902
- if not self._artifact_manager.exists(atf.name if atf.name is not None else "", atf.version):
903
- raise ValueError(f"Artifact {atf.name}/{atf.version} not found in model registry.")
904
- new_model["ARTIFACT_IDS"] = [art._id for art in artifacts]
905
-
906
865
  existing_model_nums = self._list_selected_models(model_name=model_name, model_version=model_version).count()
907
866
  if existing_model_nums:
908
867
  raise connector.DataError(
@@ -1356,42 +1315,6 @@ fully integrated into the new registry.
1356
1315
  else:
1357
1316
  return dict()
1358
1317
 
1359
- @telemetry.send_api_usage_telemetry(
1360
- project=_TELEMETRY_PROJECT,
1361
- subproject=_TELEMETRY_SUBPROJECT,
1362
- )
1363
- @snowpark._internal.utils.private_preview(version="1.0.10")
1364
- def log_artifact(
1365
- self,
1366
- artifact: artifact.Artifact,
1367
- name: str,
1368
- version: Optional[str] = None,
1369
- ) -> artifact.Artifact:
1370
- """Upload and register an artifact to the Model Registry.
1371
-
1372
- Args:
1373
- artifact: artifact object.
1374
- name: name of artifact.
1375
- version: version of artifact.
1376
-
1377
- Raises:
1378
- DataError: Artifact with same name and version already exists.
1379
-
1380
- Returns:
1381
- Return a reference to the artifact.
1382
- """
1383
-
1384
- if self._artifact_manager.exists(name, version):
1385
- raise connector.DataError(f"Artifact {name}/{version} already exists.")
1386
-
1387
- artifact_id = self._get_new_unique_identifier()
1388
- return self._artifact_manager.add(
1389
- artifact=artifact,
1390
- artifact_id=artifact_id,
1391
- artifact_name=name,
1392
- artifact_version=version,
1393
- )
1394
-
1395
1318
  # Combined Registry and Repository operations.
1396
1319
  @telemetry.send_api_usage_telemetry(
1397
1320
  project=_TELEMETRY_PROJECT,
@@ -1410,7 +1333,6 @@ fully integrated into the new registry.
1410
1333
  pip_requirements: Optional[List[str]] = None,
1411
1334
  signatures: Optional[Dict[str, model_signature.ModelSignature]] = None,
1412
1335
  sample_input_data: Optional[Any] = None,
1413
- artifacts: Optional[List[artifact.Artifact]] = None,
1414
1336
  code_paths: Optional[List[str]] = None,
1415
1337
  options: Optional[model_types.BaseModelSaveOption] = None,
1416
1338
  ) -> Optional["ModelReference"]:
@@ -1431,19 +1353,15 @@ fully integrated into the new registry.
1431
1353
  pip requirements.
1432
1354
  signatures: Signatures of the model, which is a mapping from target method name to signatures of input and
1433
1355
  output, which could be inferred by calling `infer_signature` method with sample input data.
1434
- sample_input_data: Sample of the input data for the model. If artifacts contains a feature store
1435
- generated dataset, then sample_input_data is not needed. If both sample_input_data and dataset provided
1436
- , then sample_input_data will be used to infer model signature.
1437
- artifacts: A list of artifact ids, which are generated from log_artifact().
1356
+ sample_input_data: Sample of the input data for the model.
1438
1357
  code_paths: Directory of code to import when loading and deploying the model.
1439
1358
  options: Additional options when saving the model.
1440
1359
 
1441
1360
  Raises:
1442
1361
  DataError: Raised when:
1443
1362
  1) the given model already exists;
1444
- 2) given artifacts does not exists in this registry.
1445
1363
  ValueError: Raised when: # noqa: DAR402
1446
- 1) Signatures, sample_input_data and artifact(dataset) are both not provided and model is not a
1364
+ 1) Signatures and sample_input_data are both not provided and model is not a
1447
1365
  snowflake estimator.
1448
1366
  Exception: Raised when there is any error raised when saving the model.
1449
1367
 
@@ -1458,18 +1376,6 @@ fully integrated into the new registry.
1458
1376
 
1459
1377
  self._model_identifier_is_nonempty_or_raise(model_name, model_version)
1460
1378
 
1461
- if artifacts is not None:
1462
- for atf in artifacts:
1463
- if not self._artifact_manager.exists(atf.name if atf.name is not None else "", atf.version):
1464
- raise connector.DataError(f"Artifact {atf.name}/{atf.version} does not exists.")
1465
-
1466
- if sample_input_data is None and artifacts is not None:
1467
- for atf in artifacts:
1468
- if atf.type == artifact.ArtifactType.DATASET:
1469
- ds = self.get_artifact(atf.name if atf.name is not None else "", atf.version)
1470
- sample_input_data = ds.features_df()
1471
- break
1472
-
1473
1379
  existing_model_nums = self._list_selected_models(model_name=model_name, model_version=model_version).count()
1474
1380
  if existing_model_nums:
1475
1381
  raise connector.DataError(f"Model {model_name}/{model_version} already exists. Unable to log the model.")
@@ -1508,7 +1414,6 @@ fully integrated into the new registry.
1508
1414
  uri=uri.get_uri_from_snowflake_stage_path(stage_path),
1509
1415
  description=description,
1510
1416
  tags=tags,
1511
- artifacts=artifacts,
1512
1417
  )
1513
1418
 
1514
1419
  return ModelReference(registry=self, model_name=model_name, model_version=model_version)
@@ -1733,25 +1638,6 @@ fully integrated into the new registry.
1733
1638
  )
1734
1639
  return cast(snowpark.DataFrame, res)
1735
1640
 
1736
- @snowpark._internal.utils.private_preview(version="1.0.1")
1737
- def list_artifacts(self, model_name: str, model_version: Optional[str] = None) -> snowpark.DataFrame:
1738
- """List all artifacts that associated with given model name and version.
1739
-
1740
- Args:
1741
- model_name: Name of model.
1742
- model_version: Version of model. If version is none then only filter on name.
1743
- Defaults to none.
1744
-
1745
- Returns:
1746
- A snowpark dataframe that contains all artifacts that associated with the given model.
1747
- """
1748
- artifacts = self._session.sql(f"SELECT * FROM {self._fully_qualified_artifact_view_name()}").filter(
1749
- snowpark.Column("MODEL_NAME") == model_name
1750
- )
1751
- if model_version is not None:
1752
- artifacts = artifacts.filter(snowpark.Column("MODEL_VERSION") == model_version)
1753
- return cast(snowpark.DataFrame, artifacts)
1754
-
1755
1641
  @telemetry.send_api_usage_telemetry(
1756
1642
  project=_TELEMETRY_PROJECT,
1757
1643
  subproject=_TELEMETRY_SUBPROJECT,
@@ -1782,38 +1668,6 @@ fully integrated into the new registry.
1782
1668
  )
1783
1669
  return cast(snowpark.DataFrame, deployment)
1784
1670
 
1785
- @telemetry.send_api_usage_telemetry(
1786
- project=_TELEMETRY_PROJECT,
1787
- subproject=_TELEMETRY_SUBPROJECT,
1788
- )
1789
- @snowpark._internal.utils.private_preview(version="1.0.11")
1790
- def get_artifact(self, name: str, version: Optional[str] = None) -> Optional[artifact.Artifact]:
1791
- """Get artifact with the given (name, version).
1792
-
1793
- Args:
1794
- name: Name of artifact.
1795
- version: Version of artifact.
1796
-
1797
- Returns:
1798
- A reference to artifact if found, otherwise none.
1799
- """
1800
- artifacts = self._artifact_manager.get(
1801
- name,
1802
- version,
1803
- ).collect()
1804
-
1805
- if len(artifacts) == 0:
1806
- return None
1807
-
1808
- atf = artifacts[0]
1809
- if atf["TYPE"] == artifact.ArtifactType.DATASET.value:
1810
- ds = dataset.Dataset.from_json(atf["ARTIFACT_SPEC"], self._session)
1811
- ds._log(name=atf["NAME"], version=atf["VERSION"], id=atf["ID"])
1812
- return ds
1813
-
1814
- assert f"Unrecognized artifact type: {atf['TYPE']}"
1815
- return None
1816
-
1817
1671
  @telemetry.send_api_usage_telemetry(
1818
1672
  project=_TELEMETRY_PROJECT,
1819
1673
  subproject=_TELEMETRY_SUBPROJECT,
snowflake/ml/version.py CHANGED
@@ -1 +1 @@
1
- VERSION="1.4.1"
1
+ VERSION="1.5.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: snowflake-ml-python
3
- Version: 1.4.1
3
+ Version: 1.5.0
4
4
  Summary: The machine learning client library that is used for interacting with Snowflake to build machine learning solutions.
5
5
  Author-email: "Snowflake, Inc" <support@snowflake.com>
6
6
  License:
@@ -371,7 +371,68 @@ be compatibility issues. Server-side functionality that `snowflake-ml-python` de
371
371
 
372
372
  # Release History
373
373
 
374
- ## 1.4.1
374
+ ## 1.5.0
375
+
376
+ ### Bug Fixes
377
+
378
+ - Registry: Fix invalid parameter 'SHOW_MODEL_DETAILS_IN_SHOW_VERSIONS_IN_MODEL' error.
379
+
380
+ ### Behavior Changes
381
+
382
+ - Model Development: The behavior of `fit_transform` for all estimators is changed.
383
+ Firstly, it will cover all the estimator that contains this function,
384
+ secondly, the output would be the union of pandas DataFrame and snowpark DataFrame.
385
+
386
+ #### Model Registry (PrPr)
387
+
388
+ `snowflake.ml.registry.artifact` and related `snowflake.ml.model_registry.ModelRegistry` APIs have been removed.
389
+
390
+ - Removed `snowflake.ml.registry.artifact` module.
391
+ - Removed `ModelRegistry.log_artifact()`, `ModelRegistry.list_artifacts()`, `ModelRegistry.get_artifact()`
392
+ - Removed `artifacts` argument from `ModelRegistry.log_model()`
393
+
394
+ #### Dataset (PrPr)
395
+
396
+ `snowflake.ml.dataset.Dataset` has been redesigned to be backed by Snowflake Dataset entities.
397
+
398
+ - New `Dataset`s can be created with `Dataset.create()` and existing `Dataset`s may be loaded
399
+ with `Dataset.load()`.
400
+ - `Dataset`s now maintain an immutable `selected_version` state. The `Dataset.create_version()` and
401
+ `Dataset.load_version()` APIs return new `Dataset` objects with the requested `selected_version` state.
402
+ - Added `dataset.create_from_dataframe()` and `dataset.load_dataset()` convenience APIs as a shortcut
403
+ to creating and loading `Dataset`s with a pre-selected version.
404
+ - `Dataset.materialized_table` and `Dataset.snapshot_table` no longer exist with `Dataset.fully_qualified_name`
405
+ as the closest equivalent.
406
+ - `Dataset.df` no longer exists. Instead, use `DatasetReader.read.to_snowpark_dataframe()`.
407
+ - `Dataset.owner` has been moved to `Dataset.selected_version.owner`
408
+ - `Dataset.desc` has been moved to `DatasetVersion.selected_version.comment`
409
+ - `Dataset.timestamp_col`, `Dataset.label_cols`, `Dataset.feature_store_metadata`, and
410
+ `Dataset.schema_version` have been removed.
411
+
412
+ #### Feature Store (PrPr)
413
+
414
+ `FeatureStore.generate_dataset` argument list has been changed to match the new
415
+ `snowflake.ml.dataset.Dataset` definition
416
+
417
+ - `materialized_table` has been removed and replaced with `name` and `version`.
418
+ - `name` moved to first positional argument
419
+ - `save_mode` has been removed as `merge` behavior is no longer supported. The new behavior is always `errorifexists`.
420
+
421
+ ### New Features
422
+
423
+ - Registry: Add `export` method to `ModelVersion` instance to export model files.
424
+ - Registry: Add `load` method to `ModelVersion` instance to load the underlying object from the model.
425
+ - Registry: Add `Model.rename` method to `Model` instance to rename or move a model.
426
+
427
+ #### Dataset (PrPr)
428
+
429
+ - Added Snowpark DataFrame integration using `Dataset.read.to_snowpark_dataframe()`
430
+ - Added Pandas DataFrame integration using `Dataset.read.to_pandas()`
431
+ - Added PyTorch and TensorFlow integrations using `Dataset.read.to_torch_datapipe()`
432
+ and `Dataset.read.to_tf_dataset()` respectively.
433
+ - Added `fsspec` style file integration using `Dataset.read.files()` and `Dataset.read.filesystem()`
434
+
435
+ ## 1.4.1 (2024-04-18)
375
436
 
376
437
  ### New Features
377
438