snowflake-ml-python 1.8.2__py3-none-any.whl → 1.8.4__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 (322) hide show
  1. snowflake/cortex/__init__.py +7 -1
  2. snowflake/cortex/_classify_text.py +3 -3
  3. snowflake/cortex/_complete.py +23 -24
  4. snowflake/cortex/_embed_text_1024.py +4 -4
  5. snowflake/cortex/_embed_text_768.py +4 -4
  6. snowflake/cortex/_finetune.py +8 -8
  7. snowflake/cortex/_util.py +8 -12
  8. snowflake/ml/_internal/env.py +4 -3
  9. snowflake/ml/_internal/env_utils.py +63 -34
  10. snowflake/ml/_internal/file_utils.py +10 -21
  11. snowflake/ml/_internal/human_readable_id/hrid_generator_base.py +5 -7
  12. snowflake/ml/_internal/init_utils.py +2 -3
  13. snowflake/ml/_internal/lineage/lineage_utils.py +6 -6
  14. snowflake/ml/_internal/platform_capabilities.py +18 -16
  15. snowflake/ml/_internal/telemetry.py +39 -52
  16. snowflake/ml/_internal/type_utils.py +3 -3
  17. snowflake/ml/_internal/utils/db_utils.py +2 -2
  18. snowflake/ml/_internal/utils/identifier.py +10 -10
  19. snowflake/ml/_internal/utils/import_utils.py +2 -2
  20. snowflake/ml/_internal/utils/parallelize.py +7 -7
  21. snowflake/ml/_internal/utils/pkg_version_utils.py +11 -11
  22. snowflake/ml/_internal/utils/query_result_checker.py +4 -4
  23. snowflake/ml/_internal/utils/snowflake_env.py +28 -6
  24. snowflake/ml/_internal/utils/snowpark_dataframe_utils.py +2 -2
  25. snowflake/ml/_internal/utils/sql_identifier.py +3 -3
  26. snowflake/ml/_internal/utils/table_manager.py +9 -9
  27. snowflake/ml/data/_internal/arrow_ingestor.py +7 -7
  28. snowflake/ml/data/data_connector.py +15 -36
  29. snowflake/ml/data/data_ingestor.py +4 -15
  30. snowflake/ml/data/data_source.py +2 -2
  31. snowflake/ml/data/ingestor_utils.py +3 -3
  32. snowflake/ml/data/torch_utils.py +5 -5
  33. snowflake/ml/dataset/dataset.py +11 -11
  34. snowflake/ml/dataset/dataset_metadata.py +8 -8
  35. snowflake/ml/dataset/dataset_reader.py +7 -7
  36. snowflake/ml/feature_store/__init__.py +1 -1
  37. snowflake/ml/feature_store/access_manager.py +7 -7
  38. snowflake/ml/feature_store/entity.py +6 -6
  39. snowflake/ml/feature_store/examples/airline_features/entities.py +1 -3
  40. snowflake/ml/feature_store/examples/airline_features/features/plane_features.py +1 -3
  41. snowflake/ml/feature_store/examples/airline_features/features/weather_features.py +1 -3
  42. snowflake/ml/feature_store/examples/citibike_trip_features/entities.py +1 -3
  43. snowflake/ml/feature_store/examples/citibike_trip_features/features/station_feature.py +1 -3
  44. snowflake/ml/feature_store/examples/citibike_trip_features/features/trip_feature.py +1 -3
  45. snowflake/ml/feature_store/examples/example_helper.py +16 -16
  46. snowflake/ml/feature_store/examples/new_york_taxi_features/entities.py +1 -3
  47. snowflake/ml/feature_store/examples/new_york_taxi_features/features/location_features.py +1 -3
  48. snowflake/ml/feature_store/examples/new_york_taxi_features/features/trip_features.py +1 -3
  49. snowflake/ml/feature_store/examples/wine_quality_features/entities.py +1 -3
  50. snowflake/ml/feature_store/examples/wine_quality_features/features/managed_wine_features.py +1 -3
  51. snowflake/ml/feature_store/examples/wine_quality_features/features/static_wine_features.py +1 -3
  52. snowflake/ml/feature_store/feature_store.py +52 -64
  53. snowflake/ml/feature_store/feature_view.py +24 -24
  54. snowflake/ml/fileset/embedded_stage_fs.py +5 -5
  55. snowflake/ml/fileset/fileset.py +5 -5
  56. snowflake/ml/fileset/sfcfs.py +13 -13
  57. snowflake/ml/fileset/stage_fs.py +15 -15
  58. snowflake/ml/jobs/_utils/constants.py +1 -1
  59. snowflake/ml/jobs/_utils/interop_utils.py +10 -10
  60. snowflake/ml/jobs/_utils/payload_utils.py +45 -46
  61. snowflake/ml/jobs/_utils/scripts/get_instance_ip.py +4 -4
  62. snowflake/ml/jobs/_utils/scripts/mljob_launcher.py +8 -5
  63. snowflake/ml/jobs/_utils/scripts/signal_workers.py +8 -8
  64. snowflake/ml/jobs/_utils/spec_utils.py +18 -29
  65. snowflake/ml/jobs/_utils/types.py +2 -2
  66. snowflake/ml/jobs/decorators.py +10 -5
  67. snowflake/ml/jobs/job.py +87 -30
  68. snowflake/ml/jobs/manager.py +86 -56
  69. snowflake/ml/lineage/lineage_node.py +5 -5
  70. snowflake/ml/model/_client/model/model_impl.py +3 -3
  71. snowflake/ml/model/_client/model/model_version_impl.py +103 -35
  72. snowflake/ml/model/_client/ops/metadata_ops.py +7 -7
  73. snowflake/ml/model/_client/ops/model_ops.py +41 -41
  74. snowflake/ml/model/_client/ops/service_ops.py +217 -32
  75. snowflake/ml/model/_client/service/model_deployment_spec.py +359 -65
  76. snowflake/ml/model/_client/service/model_deployment_spec_schema.py +69 -24
  77. snowflake/ml/model/_client/sql/model.py +8 -8
  78. snowflake/ml/model/_client/sql/model_version.py +26 -26
  79. snowflake/ml/model/_client/sql/service.py +17 -26
  80. snowflake/ml/model/_client/sql/stage.py +2 -2
  81. snowflake/ml/model/_client/sql/tag.py +6 -6
  82. snowflake/ml/model/_model_composer/model_composer.py +58 -32
  83. snowflake/ml/model/_model_composer/model_manifest/model_manifest.py +20 -16
  84. snowflake/ml/model/_model_composer/model_manifest/model_manifest_schema.py +14 -13
  85. snowflake/ml/model/_model_composer/model_method/model_method.py +3 -3
  86. snowflake/ml/model/_packager/model_env/model_env.py +28 -25
  87. snowflake/ml/model/_packager/model_handler.py +4 -4
  88. snowflake/ml/model/_packager/model_handlers/_base.py +2 -2
  89. snowflake/ml/model/_packager/model_handlers/_utils.py +47 -5
  90. snowflake/ml/model/_packager/model_handlers/catboost.py +5 -5
  91. snowflake/ml/model/_packager/model_handlers/custom.py +9 -5
  92. snowflake/ml/model/_packager/model_handlers/huggingface_pipeline.py +7 -21
  93. snowflake/ml/model/_packager/model_handlers/keras.py +4 -4
  94. snowflake/ml/model/_packager/model_handlers/lightgbm.py +4 -14
  95. snowflake/ml/model/_packager/model_handlers/mlflow.py +3 -3
  96. snowflake/ml/model/_packager/model_handlers/pytorch.py +5 -6
  97. snowflake/ml/model/_packager/model_handlers/sentence_transformers.py +5 -5
  98. snowflake/ml/model/_packager/model_handlers/sklearn.py +104 -46
  99. snowflake/ml/model/_packager/model_handlers/snowmlmodel.py +3 -3
  100. snowflake/ml/model/_packager/model_handlers/tensorflow.py +11 -8
  101. snowflake/ml/model/_packager/model_handlers/torchscript.py +6 -6
  102. snowflake/ml/model/_packager/model_handlers/xgboost.py +21 -22
  103. snowflake/ml/model/_packager/model_meta/model_blob_meta.py +2 -2
  104. snowflake/ml/model/_packager/model_meta/model_meta.py +39 -38
  105. snowflake/ml/model/_packager/model_meta/model_meta_schema.py +14 -11
  106. snowflake/ml/model/_packager/model_meta_migrator/base_migrator.py +3 -3
  107. snowflake/ml/model/_packager/model_meta_migrator/migrator_plans.py +3 -3
  108. snowflake/ml/model/_packager/model_meta_migrator/migrator_v1.py +4 -4
  109. snowflake/ml/model/_packager/model_packager.py +11 -9
  110. snowflake/ml/model/_packager/model_runtime/_snowml_inference_alternative_requirements.py +32 -1
  111. snowflake/ml/model/_packager/model_runtime/model_runtime.py +4 -2
  112. snowflake/ml/model/_signatures/core.py +16 -24
  113. snowflake/ml/model/_signatures/dmatrix_handler.py +17 -4
  114. snowflake/ml/model/_signatures/utils.py +6 -6
  115. snowflake/ml/model/custom_model.py +24 -11
  116. snowflake/ml/model/model_signature.py +12 -23
  117. snowflake/ml/model/models/huggingface_pipeline.py +7 -4
  118. snowflake/ml/model/type_hints.py +3 -3
  119. snowflake/ml/modeling/_internal/estimator_utils.py +7 -7
  120. snowflake/ml/modeling/_internal/local_implementations/pandas_handlers.py +6 -6
  121. snowflake/ml/modeling/_internal/local_implementations/pandas_trainer.py +7 -7
  122. snowflake/ml/modeling/_internal/model_specifications.py +8 -10
  123. snowflake/ml/modeling/_internal/model_trainer.py +5 -5
  124. snowflake/ml/modeling/_internal/model_trainer_builder.py +6 -6
  125. snowflake/ml/modeling/_internal/snowpark_implementations/distributed_hpo_trainer.py +30 -30
  126. snowflake/ml/modeling/_internal/snowpark_implementations/snowpark_handlers.py +13 -13
  127. snowflake/ml/modeling/_internal/snowpark_implementations/snowpark_trainer.py +31 -31
  128. snowflake/ml/modeling/_internal/snowpark_implementations/xgboost_external_memory_trainer.py +19 -19
  129. snowflake/ml/modeling/_internal/transformer_protocols.py +17 -17
  130. snowflake/ml/modeling/calibration/calibrated_classifier_cv.py +9 -1
  131. snowflake/ml/modeling/cluster/affinity_propagation.py +9 -1
  132. snowflake/ml/modeling/cluster/agglomerative_clustering.py +9 -1
  133. snowflake/ml/modeling/cluster/birch.py +9 -1
  134. snowflake/ml/modeling/cluster/bisecting_k_means.py +9 -1
  135. snowflake/ml/modeling/cluster/dbscan.py +9 -1
  136. snowflake/ml/modeling/cluster/feature_agglomeration.py +9 -1
  137. snowflake/ml/modeling/cluster/k_means.py +9 -1
  138. snowflake/ml/modeling/cluster/mean_shift.py +9 -1
  139. snowflake/ml/modeling/cluster/mini_batch_k_means.py +9 -1
  140. snowflake/ml/modeling/cluster/optics.py +9 -1
  141. snowflake/ml/modeling/cluster/spectral_biclustering.py +9 -1
  142. snowflake/ml/modeling/cluster/spectral_clustering.py +9 -1
  143. snowflake/ml/modeling/cluster/spectral_coclustering.py +9 -1
  144. snowflake/ml/modeling/compose/column_transformer.py +9 -1
  145. snowflake/ml/modeling/compose/transformed_target_regressor.py +9 -1
  146. snowflake/ml/modeling/covariance/elliptic_envelope.py +9 -1
  147. snowflake/ml/modeling/covariance/empirical_covariance.py +9 -1
  148. snowflake/ml/modeling/covariance/graphical_lasso.py +9 -1
  149. snowflake/ml/modeling/covariance/graphical_lasso_cv.py +9 -1
  150. snowflake/ml/modeling/covariance/ledoit_wolf.py +9 -1
  151. snowflake/ml/modeling/covariance/min_cov_det.py +9 -1
  152. snowflake/ml/modeling/covariance/oas.py +9 -1
  153. snowflake/ml/modeling/covariance/shrunk_covariance.py +9 -1
  154. snowflake/ml/modeling/decomposition/dictionary_learning.py +9 -1
  155. snowflake/ml/modeling/decomposition/factor_analysis.py +9 -1
  156. snowflake/ml/modeling/decomposition/fast_ica.py +9 -1
  157. snowflake/ml/modeling/decomposition/incremental_pca.py +9 -1
  158. snowflake/ml/modeling/decomposition/kernel_pca.py +9 -1
  159. snowflake/ml/modeling/decomposition/mini_batch_dictionary_learning.py +9 -1
  160. snowflake/ml/modeling/decomposition/mini_batch_sparse_pca.py +9 -1
  161. snowflake/ml/modeling/decomposition/pca.py +9 -1
  162. snowflake/ml/modeling/decomposition/sparse_pca.py +9 -1
  163. snowflake/ml/modeling/decomposition/truncated_svd.py +9 -1
  164. snowflake/ml/modeling/discriminant_analysis/linear_discriminant_analysis.py +9 -1
  165. snowflake/ml/modeling/discriminant_analysis/quadratic_discriminant_analysis.py +9 -1
  166. snowflake/ml/modeling/ensemble/ada_boost_classifier.py +9 -1
  167. snowflake/ml/modeling/ensemble/ada_boost_regressor.py +9 -1
  168. snowflake/ml/modeling/ensemble/bagging_classifier.py +9 -1
  169. snowflake/ml/modeling/ensemble/bagging_regressor.py +9 -1
  170. snowflake/ml/modeling/ensemble/extra_trees_classifier.py +9 -1
  171. snowflake/ml/modeling/ensemble/extra_trees_regressor.py +9 -1
  172. snowflake/ml/modeling/ensemble/gradient_boosting_classifier.py +9 -1
  173. snowflake/ml/modeling/ensemble/gradient_boosting_regressor.py +9 -1
  174. snowflake/ml/modeling/ensemble/hist_gradient_boosting_classifier.py +9 -1
  175. snowflake/ml/modeling/ensemble/hist_gradient_boosting_regressor.py +9 -1
  176. snowflake/ml/modeling/ensemble/isolation_forest.py +9 -1
  177. snowflake/ml/modeling/ensemble/random_forest_classifier.py +9 -1
  178. snowflake/ml/modeling/ensemble/random_forest_regressor.py +9 -1
  179. snowflake/ml/modeling/ensemble/stacking_regressor.py +9 -1
  180. snowflake/ml/modeling/ensemble/voting_classifier.py +9 -1
  181. snowflake/ml/modeling/ensemble/voting_regressor.py +9 -1
  182. snowflake/ml/modeling/feature_selection/generic_univariate_select.py +9 -1
  183. snowflake/ml/modeling/feature_selection/select_fdr.py +9 -1
  184. snowflake/ml/modeling/feature_selection/select_fpr.py +9 -1
  185. snowflake/ml/modeling/feature_selection/select_fwe.py +9 -1
  186. snowflake/ml/modeling/feature_selection/select_k_best.py +9 -1
  187. snowflake/ml/modeling/feature_selection/select_percentile.py +9 -1
  188. snowflake/ml/modeling/feature_selection/sequential_feature_selector.py +9 -1
  189. snowflake/ml/modeling/feature_selection/variance_threshold.py +9 -1
  190. snowflake/ml/modeling/framework/_utils.py +10 -10
  191. snowflake/ml/modeling/framework/base.py +32 -32
  192. snowflake/ml/modeling/gaussian_process/gaussian_process_classifier.py +9 -1
  193. snowflake/ml/modeling/gaussian_process/gaussian_process_regressor.py +9 -1
  194. snowflake/ml/modeling/impute/__init__.py +1 -1
  195. snowflake/ml/modeling/impute/iterative_imputer.py +9 -1
  196. snowflake/ml/modeling/impute/knn_imputer.py +9 -1
  197. snowflake/ml/modeling/impute/missing_indicator.py +9 -1
  198. snowflake/ml/modeling/impute/simple_imputer.py +5 -5
  199. snowflake/ml/modeling/kernel_approximation/additive_chi2_sampler.py +9 -1
  200. snowflake/ml/modeling/kernel_approximation/nystroem.py +9 -1
  201. snowflake/ml/modeling/kernel_approximation/polynomial_count_sketch.py +9 -1
  202. snowflake/ml/modeling/kernel_approximation/rbf_sampler.py +9 -1
  203. snowflake/ml/modeling/kernel_approximation/skewed_chi2_sampler.py +9 -1
  204. snowflake/ml/modeling/kernel_ridge/kernel_ridge.py +9 -1
  205. snowflake/ml/modeling/lightgbm/lgbm_classifier.py +9 -1
  206. snowflake/ml/modeling/lightgbm/lgbm_regressor.py +9 -1
  207. snowflake/ml/modeling/linear_model/ard_regression.py +9 -1
  208. snowflake/ml/modeling/linear_model/bayesian_ridge.py +9 -1
  209. snowflake/ml/modeling/linear_model/elastic_net.py +9 -1
  210. snowflake/ml/modeling/linear_model/elastic_net_cv.py +9 -1
  211. snowflake/ml/modeling/linear_model/gamma_regressor.py +9 -1
  212. snowflake/ml/modeling/linear_model/huber_regressor.py +9 -1
  213. snowflake/ml/modeling/linear_model/lars.py +9 -1
  214. snowflake/ml/modeling/linear_model/lars_cv.py +9 -1
  215. snowflake/ml/modeling/linear_model/lasso.py +9 -1
  216. snowflake/ml/modeling/linear_model/lasso_cv.py +9 -1
  217. snowflake/ml/modeling/linear_model/lasso_lars.py +9 -1
  218. snowflake/ml/modeling/linear_model/lasso_lars_cv.py +9 -1
  219. snowflake/ml/modeling/linear_model/lasso_lars_ic.py +9 -1
  220. snowflake/ml/modeling/linear_model/linear_regression.py +9 -1
  221. snowflake/ml/modeling/linear_model/logistic_regression.py +9 -1
  222. snowflake/ml/modeling/linear_model/logistic_regression_cv.py +9 -1
  223. snowflake/ml/modeling/linear_model/multi_task_elastic_net.py +9 -1
  224. snowflake/ml/modeling/linear_model/multi_task_elastic_net_cv.py +9 -1
  225. snowflake/ml/modeling/linear_model/multi_task_lasso.py +9 -1
  226. snowflake/ml/modeling/linear_model/multi_task_lasso_cv.py +9 -1
  227. snowflake/ml/modeling/linear_model/orthogonal_matching_pursuit.py +9 -1
  228. snowflake/ml/modeling/linear_model/passive_aggressive_classifier.py +9 -1
  229. snowflake/ml/modeling/linear_model/passive_aggressive_regressor.py +9 -1
  230. snowflake/ml/modeling/linear_model/perceptron.py +9 -1
  231. snowflake/ml/modeling/linear_model/poisson_regressor.py +9 -1
  232. snowflake/ml/modeling/linear_model/ransac_regressor.py +9 -1
  233. snowflake/ml/modeling/linear_model/ridge.py +9 -1
  234. snowflake/ml/modeling/linear_model/ridge_classifier.py +9 -1
  235. snowflake/ml/modeling/linear_model/ridge_classifier_cv.py +9 -1
  236. snowflake/ml/modeling/linear_model/ridge_cv.py +9 -1
  237. snowflake/ml/modeling/linear_model/sgd_classifier.py +9 -1
  238. snowflake/ml/modeling/linear_model/sgd_one_class_svm.py +9 -1
  239. snowflake/ml/modeling/linear_model/sgd_regressor.py +9 -1
  240. snowflake/ml/modeling/linear_model/theil_sen_regressor.py +9 -1
  241. snowflake/ml/modeling/linear_model/tweedie_regressor.py +9 -1
  242. snowflake/ml/modeling/manifold/isomap.py +9 -1
  243. snowflake/ml/modeling/manifold/mds.py +9 -1
  244. snowflake/ml/modeling/manifold/spectral_embedding.py +9 -1
  245. snowflake/ml/modeling/manifold/tsne.py +9 -1
  246. snowflake/ml/modeling/metrics/__init__.py +1 -1
  247. snowflake/ml/modeling/metrics/classification.py +39 -39
  248. snowflake/ml/modeling/metrics/metrics_utils.py +12 -12
  249. snowflake/ml/modeling/metrics/ranking.py +7 -7
  250. snowflake/ml/modeling/metrics/regression.py +13 -13
  251. snowflake/ml/modeling/mixture/bayesian_gaussian_mixture.py +9 -1
  252. snowflake/ml/modeling/mixture/gaussian_mixture.py +9 -1
  253. snowflake/ml/modeling/model_selection/__init__.py +1 -1
  254. snowflake/ml/modeling/model_selection/grid_search_cv.py +7 -7
  255. snowflake/ml/modeling/model_selection/randomized_search_cv.py +7 -7
  256. snowflake/ml/modeling/multiclass/one_vs_one_classifier.py +9 -1
  257. snowflake/ml/modeling/multiclass/one_vs_rest_classifier.py +9 -1
  258. snowflake/ml/modeling/multiclass/output_code_classifier.py +9 -1
  259. snowflake/ml/modeling/naive_bayes/bernoulli_nb.py +9 -1
  260. snowflake/ml/modeling/naive_bayes/categorical_nb.py +9 -1
  261. snowflake/ml/modeling/naive_bayes/complement_nb.py +9 -1
  262. snowflake/ml/modeling/naive_bayes/gaussian_nb.py +9 -1
  263. snowflake/ml/modeling/naive_bayes/multinomial_nb.py +9 -1
  264. snowflake/ml/modeling/neighbors/k_neighbors_classifier.py +9 -1
  265. snowflake/ml/modeling/neighbors/k_neighbors_regressor.py +9 -1
  266. snowflake/ml/modeling/neighbors/kernel_density.py +9 -1
  267. snowflake/ml/modeling/neighbors/local_outlier_factor.py +9 -1
  268. snowflake/ml/modeling/neighbors/nearest_centroid.py +9 -1
  269. snowflake/ml/modeling/neighbors/nearest_neighbors.py +9 -1
  270. snowflake/ml/modeling/neighbors/neighborhood_components_analysis.py +9 -1
  271. snowflake/ml/modeling/neighbors/radius_neighbors_classifier.py +9 -1
  272. snowflake/ml/modeling/neighbors/radius_neighbors_regressor.py +9 -1
  273. snowflake/ml/modeling/neural_network/bernoulli_rbm.py +9 -1
  274. snowflake/ml/modeling/neural_network/mlp_classifier.py +9 -1
  275. snowflake/ml/modeling/neural_network/mlp_regressor.py +9 -1
  276. snowflake/ml/modeling/pipeline/__init__.py +1 -1
  277. snowflake/ml/modeling/pipeline/pipeline.py +18 -18
  278. snowflake/ml/modeling/preprocessing/__init__.py +1 -1
  279. snowflake/ml/modeling/preprocessing/k_bins_discretizer.py +13 -13
  280. snowflake/ml/modeling/preprocessing/max_abs_scaler.py +4 -4
  281. snowflake/ml/modeling/preprocessing/min_max_scaler.py +8 -8
  282. snowflake/ml/modeling/preprocessing/normalizer.py +0 -1
  283. snowflake/ml/modeling/preprocessing/one_hot_encoder.py +28 -28
  284. snowflake/ml/modeling/preprocessing/ordinal_encoder.py +9 -9
  285. snowflake/ml/modeling/preprocessing/polynomial_features.py +9 -1
  286. snowflake/ml/modeling/preprocessing/robust_scaler.py +7 -7
  287. snowflake/ml/modeling/preprocessing/standard_scaler.py +5 -5
  288. snowflake/ml/modeling/semi_supervised/label_propagation.py +9 -1
  289. snowflake/ml/modeling/semi_supervised/label_spreading.py +9 -1
  290. snowflake/ml/modeling/svm/linear_svc.py +9 -1
  291. snowflake/ml/modeling/svm/linear_svr.py +9 -1
  292. snowflake/ml/modeling/svm/nu_svc.py +9 -1
  293. snowflake/ml/modeling/svm/nu_svr.py +9 -1
  294. snowflake/ml/modeling/svm/svc.py +9 -1
  295. snowflake/ml/modeling/svm/svr.py +9 -1
  296. snowflake/ml/modeling/tree/decision_tree_classifier.py +9 -1
  297. snowflake/ml/modeling/tree/decision_tree_regressor.py +9 -1
  298. snowflake/ml/modeling/tree/extra_tree_classifier.py +9 -1
  299. snowflake/ml/modeling/tree/extra_tree_regressor.py +9 -1
  300. snowflake/ml/modeling/xgboost/xgb_classifier.py +9 -1
  301. snowflake/ml/modeling/xgboost/xgb_regressor.py +9 -1
  302. snowflake/ml/modeling/xgboost/xgbrf_classifier.py +9 -1
  303. snowflake/ml/modeling/xgboost/xgbrf_regressor.py +9 -1
  304. snowflake/ml/monitoring/_client/model_monitor_sql_client.py +26 -26
  305. snowflake/ml/monitoring/_manager/model_monitor_manager.py +5 -5
  306. snowflake/ml/monitoring/entities/model_monitor_config.py +6 -6
  307. snowflake/ml/monitoring/explain_visualize.py +286 -0
  308. snowflake/ml/registry/_manager/model_manager.py +55 -32
  309. snowflake/ml/registry/registry.py +39 -31
  310. snowflake/ml/utils/authentication.py +2 -2
  311. snowflake/ml/utils/connection_params.py +5 -5
  312. snowflake/ml/utils/sparse.py +5 -4
  313. snowflake/ml/utils/sql_client.py +1 -2
  314. snowflake/ml/version.py +2 -1
  315. {snowflake_ml_python-1.8.2.dist-info → snowflake_ml_python-1.8.4.dist-info}/METADATA +55 -14
  316. snowflake_ml_python-1.8.4.dist-info/RECORD +419 -0
  317. {snowflake_ml_python-1.8.2.dist-info → snowflake_ml_python-1.8.4.dist-info}/WHEEL +1 -1
  318. snowflake/ml/model/_packager/model_meta/_packaging_requirements.py +0 -1
  319. snowflake/ml/modeling/_internal/constants.py +0 -2
  320. snowflake_ml_python-1.8.2.dist-info/RECORD +0 -420
  321. {snowflake_ml_python-1.8.2.dist-info → snowflake_ml_python-1.8.4.dist-info}/licenses/LICENSE.txt +0 -0
  322. {snowflake_ml_python-1.8.2.dist-info → snowflake_ml_python-1.8.4.dist-info}/top_level.txt +0 -0
@@ -1,11 +1,10 @@
1
- import os
2
1
  from types import ModuleType
3
- from typing import Any, Dict, List, Optional, Tuple, Union
2
+ from typing import Any, Optional, Union
4
3
 
5
4
  import pandas as pd
6
5
  from absl.logging import logging
7
6
 
8
- from snowflake.ml._internal import platform_capabilities, telemetry
7
+ from snowflake.ml._internal import env, platform_capabilities, telemetry
9
8
  from snowflake.ml._internal.exceptions import error_codes, exceptions
10
9
  from snowflake.ml._internal.human_readable_id import hrid_generator
11
10
  from snowflake.ml._internal.utils import sql_identifier
@@ -13,9 +12,10 @@ from snowflake.ml.model import model_signature, type_hints as model_types
13
12
  from snowflake.ml.model._client.model import model_impl, model_version_impl
14
13
  from snowflake.ml.model._client.ops import metadata_ops, model_ops, service_ops
15
14
  from snowflake.ml.model._model_composer import model_composer
15
+ from snowflake.ml.model._model_composer.model_manifest import model_manifest_schema
16
16
  from snowflake.ml.model._packager.model_meta import model_meta
17
- from snowflake.ml.modeling._internal import constants
18
17
  from snowflake.snowpark import exceptions as snowpark_exceptions, session
18
+ from snowflake.snowpark._internal import utils as snowpark_utils
19
19
 
20
20
  logger = logging.getLogger(__name__)
21
21
 
@@ -45,20 +45,21 @@ class ModelManager:
45
45
  model_name: str,
46
46
  version_name: Optional[str] = None,
47
47
  comment: Optional[str] = None,
48
- metrics: Optional[Dict[str, Any]] = None,
49
- conda_dependencies: Optional[List[str]] = None,
50
- pip_requirements: Optional[List[str]] = None,
51
- artifact_repository_map: Optional[Dict[str, str]] = None,
52
- target_platforms: Optional[List[model_types.SupportedTargetPlatformType]] = None,
48
+ metrics: Optional[dict[str, Any]] = None,
49
+ conda_dependencies: Optional[list[str]] = None,
50
+ pip_requirements: Optional[list[str]] = None,
51
+ artifact_repository_map: Optional[dict[str, str]] = None,
52
+ resource_constraint: Optional[dict[str, str]] = None,
53
+ target_platforms: Optional[list[model_types.SupportedTargetPlatformType]] = None,
53
54
  python_version: Optional[str] = None,
54
- signatures: Optional[Dict[str, model_signature.ModelSignature]] = None,
55
+ signatures: Optional[dict[str, model_signature.ModelSignature]] = None,
55
56
  sample_input_data: Optional[model_types.SupportedDataType] = None,
56
- user_files: Optional[Dict[str, List[str]]] = None,
57
- code_paths: Optional[List[str]] = None,
58
- ext_modules: Optional[List[ModuleType]] = None,
57
+ user_files: Optional[dict[str, list[str]]] = None,
58
+ code_paths: Optional[list[str]] = None,
59
+ ext_modules: Optional[list[ModuleType]] = None,
59
60
  task: model_types.Task = model_types.Task.UNKNOWN,
60
61
  options: Optional[model_types.ModelSaveOption] = None,
61
- statement_params: Optional[Dict[str, Any]] = None,
62
+ statement_params: Optional[dict[str, Any]] = None,
62
63
  ) -> model_version_impl.ModelVersion:
63
64
 
64
65
  database_name_id, schema_name_id, model_name_id = self._parse_fully_qualified_name(model_name)
@@ -131,6 +132,7 @@ class ModelManager:
131
132
  conda_dependencies=conda_dependencies,
132
133
  pip_requirements=pip_requirements,
133
134
  artifact_repository_map=artifact_repository_map,
135
+ resource_constraint=resource_constraint,
134
136
  target_platforms=target_platforms,
135
137
  python_version=python_version,
136
138
  signatures=signatures,
@@ -150,25 +152,29 @@ class ModelManager:
150
152
  model_name: str,
151
153
  version_name: str,
152
154
  comment: Optional[str] = None,
153
- metrics: Optional[Dict[str, Any]] = None,
154
- conda_dependencies: Optional[List[str]] = None,
155
- pip_requirements: Optional[List[str]] = None,
156
- artifact_repository_map: Optional[Dict[str, str]] = None,
157
- target_platforms: Optional[List[model_types.SupportedTargetPlatformType]] = None,
155
+ metrics: Optional[dict[str, Any]] = None,
156
+ conda_dependencies: Optional[list[str]] = None,
157
+ pip_requirements: Optional[list[str]] = None,
158
+ artifact_repository_map: Optional[dict[str, str]] = None,
159
+ resource_constraint: Optional[dict[str, str]] = None,
160
+ target_platforms: Optional[list[model_types.SupportedTargetPlatformType]] = None,
158
161
  python_version: Optional[str] = None,
159
- signatures: Optional[Dict[str, model_signature.ModelSignature]] = None,
162
+ signatures: Optional[dict[str, model_signature.ModelSignature]] = None,
160
163
  sample_input_data: Optional[model_types.SupportedDataType] = None,
161
- user_files: Optional[Dict[str, List[str]]] = None,
162
- code_paths: Optional[List[str]] = None,
163
- ext_modules: Optional[List[ModuleType]] = None,
164
+ user_files: Optional[dict[str, list[str]]] = None,
165
+ code_paths: Optional[list[str]] = None,
166
+ ext_modules: Optional[list[ModuleType]] = None,
164
167
  task: model_types.Task = model_types.Task.UNKNOWN,
165
168
  options: Optional[model_types.ModelSaveOption] = None,
166
- statement_params: Optional[Dict[str, Any]] = None,
169
+ statement_params: Optional[dict[str, Any]] = None,
167
170
  ) -> model_version_impl.ModelVersion:
168
171
  database_name_id, schema_name_id, model_name_id = sql_identifier.parse_fully_qualified_name(model_name)
169
172
  version_name_id = sql_identifier.SqlIdentifier(version_name)
170
173
 
171
- use_live_commit = platform_capabilities.PlatformCapabilities.get_instance().is_live_commit_enabled()
174
+ # TODO(SNOW-2091317): Remove this when the snowpark enables file PUT operation for snowurls
175
+ use_live_commit = (
176
+ not snowpark_utils.is_in_stored_procedure() # type: ignore[no-untyped-call]
177
+ ) and platform_capabilities.PlatformCapabilities.get_instance().is_live_commit_enabled()
172
178
  if use_live_commit:
173
179
  logger.info("Using live commit model version")
174
180
  else:
@@ -211,8 +217,24 @@ class ModelManager:
211
217
  # Convert any string target platforms to TargetPlatform objects
212
218
  platforms = [model_types.TargetPlatform(platform) for platform in target_platforms]
213
219
  else:
220
+ # Default the target platform to warehouse if not specified and any table function exists
221
+ if options and (
222
+ options.get("function_type") == model_manifest_schema.ModelMethodFunctionTypes.TABLE_FUNCTION.value
223
+ or (
224
+ any(
225
+ opt.get("function_type") == "TABLE_FUNCTION"
226
+ for opt in options.get("method_options", {}).values()
227
+ )
228
+ )
229
+ ):
230
+ logger.info(
231
+ "Logging a partitioned model with a table function without specifying `target_platforms`. "
232
+ 'Default to `target_platforms=["WAREHOUSE"]`.'
233
+ )
234
+ platforms = [model_types.TargetPlatform.WAREHOUSE]
235
+
214
236
  # Default the target platform to SPCS if not specified when running in ML runtime
215
- if os.getenv(constants.IN_ML_RUNTIME_ENV_VAR):
237
+ if not platforms and env.IN_ML_RUNTIME:
216
238
  logger.info(
217
239
  "Logging the model on Container Runtime for ML without specifying `target_platforms`. "
218
240
  'Default to `target_platforms=["SNOWPARK_CONTAINER_SERVICES"]`.'
@@ -253,6 +275,7 @@ class ModelManager:
253
275
  conda_dependencies=conda_dependencies,
254
276
  pip_requirements=pip_requirements,
255
277
  artifact_repository_map=artifact_repository_map,
278
+ resource_constraint=resource_constraint,
256
279
  target_platforms=platforms,
257
280
  python_version=python_version,
258
281
  user_files=user_files,
@@ -314,7 +337,7 @@ class ModelManager:
314
337
  self,
315
338
  model_name: str,
316
339
  *,
317
- statement_params: Optional[Dict[str, Any]] = None,
340
+ statement_params: Optional[dict[str, Any]] = None,
318
341
  ) -> model_impl.Model:
319
342
  database_name_id, schema_name_id, model_name_id = self._parse_fully_qualified_name(model_name)
320
343
  if self._model_ops.validate_existence(
@@ -342,8 +365,8 @@ class ModelManager:
342
365
  def models(
343
366
  self,
344
367
  *,
345
- statement_params: Optional[Dict[str, Any]] = None,
346
- ) -> List[model_impl.Model]:
368
+ statement_params: Optional[dict[str, Any]] = None,
369
+ ) -> list[model_impl.Model]:
347
370
  model_names = self._model_ops.list_models_or_versions(
348
371
  database_name=None,
349
372
  schema_name=None,
@@ -361,7 +384,7 @@ class ModelManager:
361
384
  def show_models(
362
385
  self,
363
386
  *,
364
- statement_params: Optional[Dict[str, Any]] = None,
387
+ statement_params: Optional[dict[str, Any]] = None,
365
388
  ) -> pd.DataFrame:
366
389
  rows = self._model_ops.show_models_or_versions(
367
390
  database_name=None,
@@ -374,7 +397,7 @@ class ModelManager:
374
397
  self,
375
398
  model_name: str,
376
399
  *,
377
- statement_params: Optional[Dict[str, Any]] = None,
400
+ statement_params: Optional[dict[str, Any]] = None,
378
401
  ) -> None:
379
402
  database_name_id, schema_name_id, model_name_id = self._parse_fully_qualified_name(model_name)
380
403
 
@@ -387,7 +410,7 @@ class ModelManager:
387
410
 
388
411
  def _parse_fully_qualified_name(
389
412
  self, model_name: str
390
- ) -> Tuple[
413
+ ) -> tuple[
391
414
  Optional[sql_identifier.SqlIdentifier], Optional[sql_identifier.SqlIdentifier], sql_identifier.SqlIdentifier
392
415
  ]:
393
416
  try:
@@ -1,6 +1,6 @@
1
1
  import warnings
2
2
  from types import ModuleType
3
- from typing import Any, Dict, List, Optional, Union, overload
3
+ from typing import Any, Optional, Union, overload
4
4
 
5
5
  import pandas as pd
6
6
 
@@ -36,7 +36,7 @@ class Registry:
36
36
  *,
37
37
  database_name: Optional[str] = None,
38
38
  schema_name: Optional[str] = None,
39
- options: Optional[Dict[str, Any]] = None,
39
+ options: Optional[dict[str, Any]] = None,
40
40
  ) -> None:
41
41
  """Opens a registry within a pre-created Snowflake schema.
42
42
 
@@ -107,17 +107,18 @@ class Registry:
107
107
  model_name: str,
108
108
  version_name: Optional[str] = None,
109
109
  comment: Optional[str] = None,
110
- metrics: Optional[Dict[str, Any]] = None,
111
- conda_dependencies: Optional[List[str]] = None,
112
- pip_requirements: Optional[List[str]] = None,
113
- artifact_repository_map: Optional[Dict[str, str]] = None,
114
- target_platforms: Optional[List[model_types.SupportedTargetPlatformType]] = None,
110
+ metrics: Optional[dict[str, Any]] = None,
111
+ conda_dependencies: Optional[list[str]] = None,
112
+ pip_requirements: Optional[list[str]] = None,
113
+ artifact_repository_map: Optional[dict[str, str]] = None,
114
+ resource_constraint: Optional[dict[str, str]] = None,
115
+ target_platforms: Optional[list[model_types.SupportedTargetPlatformType]] = None,
115
116
  python_version: Optional[str] = None,
116
- signatures: Optional[Dict[str, model_signature.ModelSignature]] = None,
117
+ signatures: Optional[dict[str, model_signature.ModelSignature]] = None,
117
118
  sample_input_data: Optional[model_types.SupportedDataType] = None,
118
- user_files: Optional[Dict[str, List[str]]] = None,
119
- code_paths: Optional[List[str]] = None,
120
- ext_modules: Optional[List[ModuleType]] = None,
119
+ user_files: Optional[dict[str, list[str]]] = None,
120
+ code_paths: Optional[list[str]] = None,
121
+ ext_modules: Optional[list[ModuleType]] = None,
121
122
  task: model_types.Task = model_types.Task.UNKNOWN,
122
123
  options: Optional[model_types.ModelSaveOption] = None,
123
124
  ) -> ModelVersion:
@@ -147,11 +148,12 @@ class Registry:
147
148
  dependencies must be retrieved from Snowflake Anaconda Channel.
148
149
  artifact_repository_map: Specifies a mapping of package channels or platforms to custom artifact
149
150
  repositories. Defaults to None. Currently, the mapping applies only to warehouse execution.
150
- Note : This feature is currently in Private Preview; please contact your Snowflake account team
151
- to enable it.
151
+ Note : This feature is currently in Public Preview.
152
152
  Format: {channel_name: artifact_repository_name}, where:
153
- - channel_name: The name of the Conda package channel (e.g., 'condaforge') or 'pip' for pip packages.
154
- - artifact_repository_name: The name or URL of the repository to fetch packages from.
153
+ - channel_name: Currently must be 'pip'.
154
+ - artifact_repository_name: The identifier of the artifact repository to fetch packages from, e.g.
155
+ `snowflake.snowpark.pypi_shared_repository`.
156
+ resource_constraint: Mapping of resource constraint keys and values, e.g. {"architecture": "x86"}.
155
157
  target_platforms: List of target platforms to run the model. The only acceptable inputs are a combination of
156
158
  {"WAREHOUSE", "SNOWPARK_CONTAINER_SERVICES"}. Defaults to None.
157
159
  python_version: Python version in which the model is run. Defaults to None.
@@ -232,6 +234,7 @@ class Registry:
232
234
  "conda_dependencies",
233
235
  "pip_requirements",
234
236
  "artifact_repository_map",
237
+ "resource_constraint",
235
238
  "target_platforms",
236
239
  "python_version",
237
240
  "signatures",
@@ -244,17 +247,18 @@ class Registry:
244
247
  model_name: str,
245
248
  version_name: Optional[str] = None,
246
249
  comment: Optional[str] = None,
247
- metrics: Optional[Dict[str, Any]] = None,
248
- conda_dependencies: Optional[List[str]] = None,
249
- pip_requirements: Optional[List[str]] = None,
250
- artifact_repository_map: Optional[Dict[str, str]] = None,
251
- target_platforms: Optional[List[model_types.SupportedTargetPlatformType]] = None,
250
+ metrics: Optional[dict[str, Any]] = None,
251
+ conda_dependencies: Optional[list[str]] = None,
252
+ pip_requirements: Optional[list[str]] = None,
253
+ artifact_repository_map: Optional[dict[str, str]] = None,
254
+ resource_constraint: Optional[dict[str, str]] = None,
255
+ target_platforms: Optional[list[model_types.SupportedTargetPlatformType]] = None,
252
256
  python_version: Optional[str] = None,
253
- signatures: Optional[Dict[str, model_signature.ModelSignature]] = None,
257
+ signatures: Optional[dict[str, model_signature.ModelSignature]] = None,
254
258
  sample_input_data: Optional[model_types.SupportedDataType] = None,
255
- user_files: Optional[Dict[str, List[str]]] = None,
256
- code_paths: Optional[List[str]] = None,
257
- ext_modules: Optional[List[ModuleType]] = None,
259
+ user_files: Optional[dict[str, list[str]]] = None,
260
+ code_paths: Optional[list[str]] = None,
261
+ ext_modules: Optional[list[ModuleType]] = None,
258
262
  task: model_types.Task = model_types.Task.UNKNOWN,
259
263
  options: Optional[model_types.ModelSaveOption] = None,
260
264
  ) -> ModelVersion:
@@ -284,13 +288,15 @@ class Registry:
284
288
  dependencies must be retrieved from Snowflake Anaconda Channel.
285
289
  artifact_repository_map: Specifies a mapping of package channels or platforms to custom artifact
286
290
  repositories. Defaults to None. Currently, the mapping applies only to warehouse execution.
287
- Note : This feature is currently in Private Preview; please contact your Snowflake account team to
288
- enable it.
291
+ Note : This feature is currently in Public Preview.
289
292
  Format: {channel_name: artifact_repository_name}, where:
290
- - channel_name: The name of the Conda package channel (e.g., 'condaforge') or 'pip' for pip packages.
291
- - artifact_repository_name: The name or URL of the repository to fetch packages from.
293
+ - channel_name: Currently must be 'pip'.
294
+ - artifact_repository_name: The identifier of the artifact repository to fetch packages from, e.g.
295
+ `snowflake.snowpark.pypi_shared_repository`.
296
+ resource_constraint: Mapping of resource constraint keys and values, e.g. {"architecture": "x86"}.
292
297
  target_platforms: List of target platforms to run the model. The only acceptable inputs are a combination of
293
- {"WAREHOUSE", "SNOWPARK_CONTAINER_SERVICES"}. Defaults to None.
298
+ ["WAREHOUSE", "SNOWPARK_CONTAINER_SERVICES"]. Defaults to None. When None, the target platforms will be
299
+ both.
294
300
  python_version: Python version in which the model is run. Defaults to None.
295
301
  signatures: Model data signatures for inputs and outputs for various target methods. If it is None,
296
302
  sample_input_data would be used to infer the signatures for those models that cannot automatically
@@ -373,6 +379,7 @@ class Registry:
373
379
  conda_dependencies,
374
380
  pip_requirements,
375
381
  artifact_repository_map,
382
+ resource_constraint,
376
383
  target_platforms,
377
384
  python_version,
378
385
  signatures,
@@ -407,6 +414,7 @@ class Registry:
407
414
  conda_dependencies=conda_dependencies,
408
415
  pip_requirements=pip_requirements,
409
416
  artifact_repository_map=artifact_repository_map,
417
+ resource_constraint=resource_constraint,
410
418
  target_platforms=target_platforms,
411
419
  python_version=python_version,
412
420
  signatures=signatures,
@@ -442,7 +450,7 @@ class Registry:
442
450
  project=_TELEMETRY_PROJECT,
443
451
  subproject=_MODEL_TELEMETRY_SUBPROJECT,
444
452
  )
445
- def models(self) -> List[Model]:
453
+ def models(self) -> list[Model]:
446
454
  """Get all models in the schema where the registry is opened.
447
455
 
448
456
  Returns:
@@ -568,7 +576,7 @@ class Registry:
568
576
  subproject=telemetry.TelemetrySubProject.MONITORING.value,
569
577
  )
570
578
  @snowpark._internal.utils.private_preview(version=model_monitor_version.SNOWFLAKE_ML_MONITORING_MIN_VERSION)
571
- def show_model_monitors(self) -> List[snowpark.Row]:
579
+ def show_model_monitors(self) -> list[snowpark.Row]:
572
580
  """Show all model monitors in the registry.
573
581
 
574
582
  Returns:
@@ -1,7 +1,7 @@
1
1
  import http
2
2
  import logging
3
3
  from datetime import timedelta
4
- from typing import Dict, Optional
4
+ from typing import Optional
5
5
 
6
6
  import requests
7
7
  from cryptography.hazmat.primitives.asymmetric import types
@@ -10,7 +10,7 @@ from requests import auth
10
10
  from snowflake.ml._internal.utils import jwt_generator
11
11
 
12
12
  logger = logging.getLogger(__name__)
13
- _JWT_TOKEN_CACHE: Dict[str, Dict[int, str]] = {}
13
+ _JWT_TOKEN_CACHE: dict[str, dict[int, str]] = {}
14
14
 
15
15
 
16
16
  def get_jwt_token_generator(
@@ -1,6 +1,6 @@
1
1
  import configparser
2
2
  import os
3
- from typing import Dict, Optional, Union
3
+ from typing import Optional, Union
4
4
 
5
5
  from absl import logging
6
6
  from cryptography.hazmat import backends
@@ -76,7 +76,7 @@ def _load_pem_to_der(private_key_path: str) -> bytes:
76
76
  )
77
77
 
78
78
 
79
- def _connection_properties_from_env() -> Dict[str, str]:
79
+ def _connection_properties_from_env() -> dict[str, str]:
80
80
  """Returns a dict with all possible login related env variables."""
81
81
  sf_conn_prop = {
82
82
  # Mandatory fields
@@ -104,7 +104,7 @@ def _connection_properties_from_env() -> Dict[str, str]:
104
104
  return sf_conn_prop
105
105
 
106
106
 
107
- def _load_from_snowsql_config_file(connection_name: str, login_file: str = "") -> Dict[str, str]:
107
+ def _load_from_snowsql_config_file(connection_name: str, login_file: str = "") -> dict[str, str]:
108
108
  """Loads the dictionary from snowsql config file."""
109
109
  snowsql_config_file = login_file if login_file else os.path.expanduser(_DEFAULT_CONNECTION_FILE)
110
110
  if not os.path.exists(snowsql_config_file):
@@ -133,7 +133,7 @@ def _load_from_snowsql_config_file(connection_name: str, login_file: str = "") -
133
133
 
134
134
 
135
135
  @snowpark._internal.utils.private_preview(version="0.2.0")
136
- def SnowflakeLoginOptions(connection_name: str = "", login_file: Optional[str] = None) -> Dict[str, Union[str, bytes]]:
136
+ def SnowflakeLoginOptions(connection_name: str = "", login_file: Optional[str] = None) -> dict[str, Union[str, bytes]]:
137
137
  """Returns a dict that can be used directly into snowflake python connector or Snowpark session config.
138
138
 
139
139
  NOTE: Token/Auth information is sideloaded in all cases above, if provided in following order:
@@ -164,7 +164,7 @@ def SnowflakeLoginOptions(connection_name: str = "", login_file: Optional[str] =
164
164
  Raises:
165
165
  Exception: if none of config file and environment variable are present.
166
166
  """
167
- conn_prop: Dict[str, Union[str, bytes]] = {}
167
+ conn_prop: dict[str, Union[str, bytes]] = {}
168
168
  login_file = login_file or os.path.expanduser(_DEFAULT_CONNECTION_FILE)
169
169
  # If login file exists, use this exclusively.
170
170
  if os.path.exists(login_file):
@@ -1,6 +1,6 @@
1
1
  import collections
2
2
  import json
3
- from typing import List, Optional
3
+ from typing import Optional
4
4
 
5
5
  import pandas as pd
6
6
  from pandas import arrays as pandas_arrays
@@ -9,7 +9,7 @@ from pandas.core.arrays import sparse as pandas_sparse
9
9
  from snowflake.snowpark import DataFrame
10
10
 
11
11
 
12
- def _pandas_to_sparse_pandas(pandas_df: pd.DataFrame, sparse_cols: List[str]) -> Optional[pd.DataFrame]:
12
+ def _pandas_to_sparse_pandas(pandas_df: pd.DataFrame, sparse_cols: list[str]) -> Optional[pd.DataFrame]:
13
13
  """Convert the pandas df into pandas df with multiple SparseArray columns."""
14
14
  num_rows = pandas_df.shape[0]
15
15
  if num_rows == 0:
@@ -52,8 +52,9 @@ def _pandas_to_sparse_pandas(pandas_df: pd.DataFrame, sparse_cols: List[str]) ->
52
52
  return pandas_df
53
53
 
54
54
 
55
- def to_pandas_with_sparse(df: DataFrame, sparse_cols: List[str]) -> pd.DataFrame:
56
- """Load a Snowpark df with sparse columns represented in JSON strings into pandas df with multiple SparseArray columns.
55
+ def to_pandas_with_sparse(df: DataFrame, sparse_cols: list[str]) -> pd.DataFrame:
56
+ """Load a Snowpark df with sparse columns represented in JSON strings into pandas df with multiple SparseArray
57
+ columns.
57
58
 
58
59
  For example, for below input:
59
60
  ----------------------------------------------
@@ -1,5 +1,4 @@
1
1
  from enum import Enum
2
- from typing import Dict
3
2
 
4
3
 
5
4
  class CreationOption(Enum):
@@ -13,7 +12,7 @@ class CreationMode:
13
12
  self.if_not_exists = if_not_exists
14
13
  self.or_replace = or_replace
15
14
 
16
- def get_ddl_phrases(self) -> Dict[CreationOption, str]:
15
+ def get_ddl_phrases(self) -> dict[CreationOption, str]:
17
16
  if_not_exists_sql = " IF NOT EXISTS" if self.if_not_exists else ""
18
17
  or_replace_sql = " OR REPLACE" if self.or_replace else ""
19
18
  return {
snowflake/ml/version.py CHANGED
@@ -1 +1,2 @@
1
- VERSION="1.8.2"
1
+ # This is parsed by regex in conda recipe meta file. Make sure not to break it.
2
+ VERSION = "1.8.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: snowflake-ml-python
3
- Version: 1.8.2
3
+ Version: 1.8.4
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:
@@ -236,7 +236,7 @@ License-File: LICENSE.txt
236
236
  Requires-Dist: absl-py<2,>=0.15
237
237
  Requires-Dist: anyio<5,>=3.5.0
238
238
  Requires-Dist: cachetools<6,>=3.1.1
239
- Requires-Dist: cloudpickle<3,>=2.0.0
239
+ Requires-Dist: cloudpickle>=2.0.0
240
240
  Requires-Dist: cryptography
241
241
  Requires-Dist: fsspec[http]<2026,>=2024.6.1
242
242
  Requires-Dist: importlib_resources<7,>=6.1.1
@@ -244,32 +244,37 @@ Requires-Dist: numpy<2,>=1.23
244
244
  Requires-Dist: packaging<25,>=20.9
245
245
  Requires-Dist: pandas<3,>=1.0.0
246
246
  Requires-Dist: pyarrow
247
+ Requires-Dist: pydantic<3,>=2.8.2
247
248
  Requires-Dist: pyjwt<3,>=2.0.0
248
249
  Requires-Dist: pytimeparse<2,>=1.1.8
249
250
  Requires-Dist: pyyaml<7,>=6.0
250
251
  Requires-Dist: retrying<2,>=1.3.3
251
252
  Requires-Dist: s3fs<2026,>=2024.6.1
252
- Requires-Dist: scikit-learn<1.6,>=1.4
253
+ Requires-Dist: scikit-learn<1.6
253
254
  Requires-Dist: scipy<2,>=1.9
254
- Requires-Dist: snowflake-connector-python[pandas]<4,>=3.12.0
255
+ Requires-Dist: shap<1,>=0.46.0
256
+ Requires-Dist: snowflake-connector-python[pandas]<4,>=3.14.0
255
257
  Requires-Dist: snowflake-snowpark-python!=1.26.0,<2,>=1.17.0
256
258
  Requires-Dist: snowflake.core<2,>=1.0.2
257
259
  Requires-Dist: sqlparse<1,>=0.4
258
260
  Requires-Dist: typing-extensions<5,>=4.1.0
259
- Requires-Dist: xgboost<3,>=1.7.3
260
261
  Provides-Extra: all
262
+ Requires-Dist: altair<6,>=5; extra == "all"
261
263
  Requires-Dist: catboost<2,>=1.2.0; extra == "all"
262
264
  Requires-Dist: keras<4,>=2.0.0; extra == "all"
263
265
  Requires-Dist: lightgbm<5,>=4.1.0; extra == "all"
264
266
  Requires-Dist: mlflow<3,>=2.16.0; extra == "all"
265
267
  Requires-Dist: sentence-transformers<4,>=2.7.0; extra == "all"
266
268
  Requires-Dist: sentencepiece<0.2.0,>=0.1.95; extra == "all"
267
- Requires-Dist: shap<1,>=0.46.0; extra == "all"
269
+ Requires-Dist: streamlit<2,>=1.44.0; extra == "all"
268
270
  Requires-Dist: tensorflow<3,>=2.17.0; extra == "all"
269
271
  Requires-Dist: tokenizers<1,>=0.15.1; extra == "all"
270
272
  Requires-Dist: torch<3,>=2.0.1; extra == "all"
271
273
  Requires-Dist: torchdata<1,>=0.4; extra == "all"
272
274
  Requires-Dist: transformers<5,>=4.39.3; extra == "all"
275
+ Requires-Dist: xgboost<3,>=1.7.3; extra == "all"
276
+ Provides-Extra: altair
277
+ Requires-Dist: altair<6,>=5; extra == "altair"
273
278
  Provides-Extra: catboost
274
279
  Requires-Dist: catboost<2,>=1.2.0; extra == "catboost"
275
280
  Provides-Extra: keras
@@ -280,8 +285,8 @@ Provides-Extra: lightgbm
280
285
  Requires-Dist: lightgbm<5,>=4.1.0; extra == "lightgbm"
281
286
  Provides-Extra: mlflow
282
287
  Requires-Dist: mlflow<3,>=2.16.0; extra == "mlflow"
283
- Provides-Extra: shap
284
- Requires-Dist: shap<1,>=0.46.0; extra == "shap"
288
+ Provides-Extra: streamlit
289
+ Requires-Dist: streamlit<2,>=1.44.0; extra == "streamlit"
285
290
  Provides-Extra: tensorflow
286
291
  Requires-Dist: tensorflow<3,>=2.17.0; extra == "tensorflow"
287
292
  Provides-Extra: torch
@@ -293,6 +298,8 @@ Requires-Dist: sentencepiece<0.2.0,>=0.1.95; extra == "transformers"
293
298
  Requires-Dist: tokenizers<1,>=0.15.1; extra == "transformers"
294
299
  Requires-Dist: torch<3,>=2.0.1; extra == "transformers"
295
300
  Requires-Dist: transformers<5,>=4.39.3; extra == "transformers"
301
+ Provides-Extra: xgboost
302
+ Requires-Dist: xgboost<3,>=1.7.3; extra == "xgboost"
296
303
  Dynamic: license-file
297
304
 
298
305
  # Snowpark ML
@@ -403,7 +410,32 @@ NOTE: Version 1.7.0 is used as example here. Please choose the the latest versio
403
410
 
404
411
  # Release History
405
412
 
406
- ## 1.8.2
413
+ ## 1.8.4
414
+
415
+ ### Bug Fixes
416
+
417
+ - Registry: Default `enable_explainability` to True when the model can be deployed to Warehouse.
418
+ - Registry: Add `custom_model.partitioned_api` decorator and deprecate `partitioned_inference_api`.
419
+ - Registry: Fixed a bug when logging pytroch and tensorflow models that caused
420
+ `UnboundLocalError: local variable 'multiple_inputs' referenced before assignment`.
421
+
422
+ ### Breaking change
423
+
424
+ - ML Job: Updated property `id` to be fully qualified name; Introduced new property `name` to represent the ML Job name
425
+ - ML Job: Modified `list_jobs()` to return ML Job `name` instead of `id`
426
+ - Registry: Error in `log_model` if `enable_explainability` is True and model is only deployed to
427
+ Snowpark Container Services, instead of just user warning.
428
+
429
+ ### New Features
430
+
431
+ - ML Job: Extend `@remote` function decorator, `submit_file()` and `submit_directory()` to accept `database` and
432
+ `schema` parameters
433
+ - ML Job: Support querying by fully qualified name in `get_job()`
434
+ - Explainability: Added visualization functions to `snowflake.ml.monitoring` to plot explanations in notebooks.
435
+ - Explainability: Support explain for categorical transforms for sklearn pipeline
436
+ - Support categorical type for `xgboost.DMatrix` inputs.
437
+
438
+ ## 1.8.3
407
439
 
408
440
  ### Bug Fixes
409
441
 
@@ -411,6 +443,17 @@ NOTE: Version 1.7.0 is used as example here. Please choose the the latest versio
411
443
 
412
444
  ### New Features
413
445
 
446
+ - Registry: Default to the runtime cuda version if available when logging a GPU model in Container Runtime.
447
+ - ML Job: Added `as_list` argument to `MLJob.get_logs()` to enable retrieving logs
448
+ as a list of strings
449
+ - Registry: Support `ModelVersion.run_job` to run inference with a single-node Snowpark Container Services job.
450
+ - DataConnector: Removed PrPr decorators
451
+ - Registry: Default the target platform to warehouse when logging a partitioned model.
452
+
453
+ ## 1.8.2
454
+
455
+ ### New Features
456
+
414
457
  - ML Job now available as a PuPr feature
415
458
  - ML Job: Add ability to retrieve results for `@remote` decorated functions using
416
459
  new `MLJobWithResult.result()` API, which will return the unpickled result
@@ -419,7 +462,6 @@ NOTE: Version 1.7.0 is used as example here. Please choose the the latest versio
419
462
  `snowflake.snowpark.context.get_active_session()`
420
463
  - Registry: Introducing `save_location` to `log_model` using the `options` argument.
421
464
  User's can provide the path to write the model version's files that get stored in Snowflake's stage.
422
- - Registry: Include model dependencies in pip requirements by default when logging in Container Runtime.
423
465
 
424
466
  ```python
425
467
  reg.log_model(
@@ -431,8 +473,9 @@ reg.log_model(
431
473
  )
432
474
  ```
433
475
 
434
- - ML Job (PrPr): Add `instance_id` argument to `get_logs` and `show_logs` method to support multi node log retrieval
435
- - ML Job (PrPr): Add `job.get_instance_status(instance_id=...)` API to support multi node status retrieval
476
+ - Registry: Include model dependencies in pip requirements by default when logging in Container Runtime.
477
+ - Multi-node ML Job (PrPr): Add `instance_id` argument to `get_logs` and `show_logs` method to support multi node log retrieval
478
+ - Multi-node ML Job (PrPr): Add `job.get_instance_status(instance_id=...)` API to support multi node status retrieval
436
479
 
437
480
  ## 1.8.1 (03-26-2025)
438
481
 
@@ -442,8 +485,6 @@ reg.log_model(
442
485
  inference method.
443
486
  - Registry: Fix a bug that model inference service creation fails on an existing and suspended service.
444
487
 
445
- ### Behavior Change
446
-
447
488
  ### New Features
448
489
 
449
490
  - ML Job (PrPr): Update Container Runtime image version to `1.0.1`