Skip to content

Commit 39e2082

Browse files
sfc-gh-anavalosSnowflake Authors
andauthored
Project import generated by Copybara. (#180)
GitOrigin-RevId: d499cbbe2f2564d706a7c12526cb11f9a0607297 Co-authored-by: Snowflake Authors <[email protected]>
1 parent 1697443 commit 39e2082

File tree

63 files changed

+1672
-859
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1672
-859
lines changed

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# Release History
22

3-
## 1.14.0
3+
## 1.15.0
4+
5+
### Bug Fixes
6+
7+
### Behavior Changes
8+
9+
* Registry: Dropping support for deprecated `conversational` task type for Huggingface models.
10+
To read more <https://github.com/huggingface/transformers/pull/31165>
11+
12+
### New Features
13+
14+
## 1.14.0 (09-18-2025)
415

516
### Bug Fixes
617

CONTRIBUTING.md

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,9 @@ test will fail if you forget that part.
446446

447447
## Integration test
448448

449-
### Test in Store Procedure
449+
### Test in Stored Procedure
450450

451-
To test if your code is working in store procedure or not simply, you could work based on `CommonTestBase` in
451+
To test if your code is working in stored procedure or not simply, you could work based on `CommonTestBase` in
452452
`tests/integ/snowflake/ml/test_utils/common_test_base.py`. An example of such test could be found in
453453
`tests/integ/snowflake/ml/_internal/file_utils_integ_test.py`.
454454

@@ -463,32 +463,6 @@ To write a such test, you need to
463463
store procedure only rather than both locally and in store procedure, set `local=False`. If you don't want to test
464464
with caller's rights, set `test_callers_rights=False`. (Owner's rights store procedure is always tested)
465465

466-
### Compatibility Test
467-
468-
To test if your code is compatible with previous version simply, you could work based on `CommonTestBase` in
469-
`tests/integ/snowflake/ml/test_utils/common_test_base.py`.
470-
471-
To write a such test, you need to
472-
473-
1. Your test cannot have a parameter called `_snowml_pkg_ver`.
474-
1. Let your test case inherit from `common_test_base.CommonTestBase`.
475-
1. Remove all Snowpark Session creation in your test, and use `self.session` to access the session if needed.
476-
1. If you write your own `setUp` and `tearDown` method, remember to call `super().setUp()` or
477-
`super().tearDown()`.
478-
1. Write a factory method in your test class that return a tuple of a function and its parameters as a tuple. The
479-
function will be run as a store procedure in the environment with previous version of library.
480-
481-
**Note**: Since the function will be created as a store procedure, the first argument must be a Snowpark Session.
482-
The arguments tuple you provided via the factory method does not require to include the session object.
483-
484-
**Note**: To avoid any objects from current environment affecting the result, instead of using `cloudpickle` to
485-
pickle the function, the function will be created as a Python file and registered as a store procedure. This means
486-
you cannot use any object outside of the function, and if you want to import anything, you need to import inside
487-
the function definition. So it would help if you make your prepare function as simple as possible.
488-
489-
1. Decorate your test method with `common_test_base.CommonTestBase.compatibility_test`, providing the factory method
490-
you created in the above step, optional version range to test with, as well as additional package requirements.
491-
492466
## `pre-commit`
493467

494468
Pull requests against the main branch are subject to `pre-commit` checks. Those checks enforce the code style.

README.md

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# Snowpark ML
1+
# Snowflake ML Python
22

3-
Snowpark ML is a set of tools including SDKs and underlying infrastructure to build and deploy machine learning models.
4-
With Snowpark ML, you can pre-process data, train, manage and deploy ML models all within Snowflake, using a single SDK,
3+
Snowflake ML Python is a set of tools including SDKs and underlying infrastructure to build and deploy machine learning models.
4+
With Snowflake ML Python, you can pre-process data, train, manage and deploy ML models all within Snowflake,
55
and benefit from Snowflake’s proven performance, scalability, stability and governance at every stage of the Machine
66
Learning workflow.
77

8-
## Key Components of Snowpark ML
8+
## Key Components of Snowflake ML Python
99

10-
The Snowpark ML Python SDK provides a number of APIs to support each stage of an end-to-end Machine Learning development
11-
and deployment process, and includes two key components.
10+
The Snowflake ML Python SDK provides a number of APIs to support each stage of an end-to-end Machine Learning development
11+
and deployment process.
1212

13-
### Snowpark ML Development
13+
### Snowflake ML Model Development
1414

15-
[Snowpark ML Development](https://docs.snowflake.com/en/developer-guide/snowpark-ml/index#ml-modeling)
15+
[Snowflake ML Model Development](https://docs.snowflake.com/developer-guide/snowflake-ml/overview#ml-modeling)
1616
provides a collection of python APIs enabling efficient ML model development directly in Snowflake:
1717

1818
1. Modeling API (`snowflake.ml.modeling`) for data preprocessing, feature engineering and model training in Snowflake.
@@ -23,19 +23,16 @@ model development classes based on sklearn, xgboost, and lightgbm.
2323
1. Framework Connectors: Optimized, secure and performant data provisioning for Pytorch and Tensorflow frameworks in
2424
their native data loader formats.
2525

26-
1. FileSet API: FileSet provides a Python fsspec-compliant API for materializing data into a Snowflake internal stage
27-
from a query or Snowpark Dataframe along with a number of convenience APIs.
26+
### Snowflake ML Ops
2827

29-
### Snowflake MLOps
28+
Snowflake ML Python contains a suite of MLOps tools. It complements
29+
the Snowflake Modeling API, and provides end to end development to deployment within Snowflake.
30+
The Snowflake ML Ops suite consists of:
3031

31-
Snowflake MLOps contains suit of tools and objects to make ML development cycle. It complements
32-
the Snowpark ML Development API, and provides end to end development to deployment within Snowflake.
33-
Currently, the API consists of:
34-
35-
1. [Registry](https://docs.snowflake.com/en/developer-guide/snowpark-ml/index#snowflake-model-registry): A python API
32+
1. [Registry](https://docs.snowflake.com/developer-guide/snowflake-ml/overview#snowflake-model-registry): A python API
3633
allows secure deployment and management of models in Snowflake, supporting models trained both inside and outside of
3734
Snowflake.
38-
2. [Feature Store](https://docs.snowflake.com/en/developer-guide/snowpark-ml/index#snowflake-feature-store): A fully
35+
2. [Feature Store](https://docs.snowflake.com/developer-guide/snowflake-ml/overview#snowflake-feature-store): A fully
3936
integrated solution for defining, managing, storing and discovering ML features derived from your data. The
4037
Snowflake Feature Store supports automated, incremental refresh from batch and streaming data sources, so that
4138
feature pipelines need be defined only once to be continuously updated with new data.
@@ -44,12 +41,19 @@ Currently, the API consists of:
4441

4542
## Getting started
4643

44+
Learn about all Snowflake ML feature offerings in the [Developer Guide](https://docs.snowflake.com/developer-guide/snowflake-ml/overview).
45+
4746
### Have your Snowflake account ready
4847

4948
If you don't have a Snowflake account yet, you can [sign up for a 30-day free trial account](https://signup.snowflake.com/).
5049

5150
### Installation
5251

52+
Snowflake ML Python is pre-installed in Container Runtime notebook environments.
53+
[Learn more](https://docs.snowflake.com/en/developer-guide/snowflake-ml/notebooks-on-spcs).
54+
55+
In Snowflake Warehouse notebook environments, snowflake-ml-python can be installed using the "Packages" drop-down menu.
56+
5357
Follow the [installation instructions](https://docs.snowflake.com/en/developer-guide/snowpark-ml/index#installing-snowpark-ml)
5458
in the Snowflake documentation.
5559

@@ -59,8 +63,8 @@ or [virtualenv](https://docs.python.org/3/tutorial/venv.html) to create a virtua
5963

6064
### Conda channels
6165

62-
The [Snowflake Conda Channel](https://repo.anaconda.com/pkgs/snowflake/) contains the official snowpark ML package releases.
63-
The recommended approach is to install `snowflake-ml-python` this conda channel:
66+
The [Snowflake Anaconda Channel](https://repo.anaconda.com/pkgs/snowflake/) contains the official snowflake-ml-python package
67+
releases. To install `snowflake-ml-python` from this conda channel:
6468

6569
```sh
6670
conda install \
@@ -69,25 +73,18 @@ conda install \
6973
snowflake-ml-python
7074
```
7175

72-
See [the developer guide](https://docs.snowflake.com/en/developer-guide/snowpark-ml/index) for installation instructions.
73-
74-
The latest version of the `snowpark-ml-python` package is also published in a conda channel in this repository. Package versions
75-
in this channel may not yet be present in the official Snowflake conda channel.
76+
See [the developer guide](https://docs.snowflake.com/en/developer-guide/snowpark-ml/index) for detailed installation instructions.
7677

77-
Install `snowflake-ml-python` from this channel with the following (being sure to replace `<version_specifier>` with the
78-
desired version, e.g. `1.0.10`):
78+
The snowflake-ml-python package is also published in [conda-forge](https://anaconda.org/conda-forge/snowflake-ml-python).
79+
To install `snowflake-ml-python` from conda forge:
7980

80-
```bash
81+
```sh
8182
conda install \
82-
-c https://raw.githubusercontent.com/snowflakedb/snowflake-ml-python/conda/releases/ \
83-
-c https://repo.anaconda.com/pkgs/snowflake \
83+
-c https://conda.anaconda.org/conda-forge/ \
8484
--override-channels \
85-
snowflake-ml-python==<version_specifier>
85+
snowflake-ml-python
8686
```
8787

88-
Note that until a `snowflake-ml-python` package version is available in the official Snowflake conda channel, there may
89-
be compatibility issues. Server-side functionality that `snowflake-ml-python` depends on may not yet be released.
90-
9188
### Verifying the package
9289

9390
1. Install cosign.

bazel/environments/conda-env-build-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ channels:
66
- https://repo.anaconda.com/pkgs/snowflake
77
- nodefaults
88
dependencies:
9+
- absl-py==1.4.0
910
- inflection==0.5.1
1011
- psutil==5.9.0
1112
- pytest-rerunfailures==12.0

ci/conda_recipe/meta.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ build:
1717
noarch: python
1818
package:
1919
name: snowflake-ml-python
20-
version: 1.14.0
20+
version: 1.15.0
2121
requirements:
2222
build:
2323
- python
2424
- bazel==6.3.2
2525
run:
26-
- absl-py>=0.15,<2
2726
- aiohttp!=4.0.0a0, !=4.0.0a1
2827
- anyio>=3.5.0,<5
2928
- cachetools>=3.1.1,<6

requirements.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@
6666

6767
- name: absl-py
6868
dev_version: 1.4.0
69-
version_requirements: '>=0.15,<2'
7069
tags:
7170
- build_essential
71+
- build_test_env
7272
# For fsspec[http] in conda
7373
- name_conda: aiohttp
7474
dev_version_conda: 3.9.5

snowflake/ml/_internal/platform_capabilities.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import json
2+
import logging
23
from contextlib import contextmanager
34
from typing import Any, Optional
45

5-
from absl import logging
66
from packaging import version
77

88
from snowflake.ml import version as snowml_version
@@ -13,6 +13,8 @@
1313
session as snowpark_session,
1414
)
1515

16+
logger = logging.getLogger(__name__)
17+
1618
LIVE_COMMIT_PARAMETER = "ENABLE_LIVE_VERSION_IN_SDK"
1719
INLINE_DEPLOYMENT_SPEC_PARAMETER = "ENABLE_INLINE_DEPLOYMENT_SPEC_FROM_CLIENT_VERSION"
1820

@@ -60,12 +62,12 @@ def clear_mock_features(cls) -> None:
6062
@classmethod # type: ignore[arg-type]
6163
@contextmanager
6264
def mock_features(cls, features: dict[str, Any] = _dummy_features) -> None: # type: ignore[misc]
63-
logging.debug(f"Setting mock features: {features}")
65+
logger.debug(f"Setting mock features: {features}")
6466
cls.set_mock_features(features)
6567
try:
6668
yield
6769
finally:
68-
logging.debug(f"Clearing mock features: {features}")
70+
logger.debug(f"Clearing mock features: {features}")
6971
cls.clear_mock_features()
7072

7173
def is_inlined_deployment_spec_enabled(self) -> bool:
@@ -98,7 +100,7 @@ def _get_features(session: snowpark_session.Session) -> dict[str, Any]:
98100
error_code=error_codes.INTERNAL_SNOWML_ERROR, original_exception=RuntimeError(message)
99101
)
100102
except snowpark_exceptions.SnowparkSQLException as e:
101-
logging.debug(f"Failed to retrieve platform capabilities: {e}")
103+
logger.debug(f"Failed to retrieve platform capabilities: {e}")
102104
# This can happen is server side is older than 9.2. That is fine.
103105
return {}
104106

@@ -144,15 +146,15 @@ def _get_version_feature(self, feature_name: str) -> version.Version:
144146

145147
value = self.features.get(feature_name)
146148
if value is None:
147-
logging.debug(f"Feature {feature_name} not found, returning large version number")
149+
logger.debug(f"Feature {feature_name} not found, returning large version number")
148150
return large_version
149151

150152
try:
151153
# Convert to string if it's not already
152154
version_str = str(value)
153155
return version.Version(version_str)
154156
except (version.InvalidVersion, ValueError, TypeError) as e:
155-
logging.debug(
157+
logger.debug(
156158
f"Failed to parse version from feature {feature_name} with value '{value}': {e}. "
157159
f"Returning large version number"
158160
)
@@ -171,7 +173,7 @@ def _is_version_feature_enabled(self, feature_name: str) -> bool:
171173
feature_version = self._get_version_feature(feature_name)
172174

173175
result = current_version >= feature_version
174-
logging.debug(
176+
logger.debug(
175177
f"Version comparison for feature {feature_name}: "
176178
f"current={current_version}, feature={feature_version}, enabled={result}"
177179
)

snowflake/ml/_internal/utils/connection_params.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import configparser
2+
import logging
23
import os
34
from typing import Optional, Union
45

5-
from absl import logging
66
from cryptography.hazmat import backends
77
from cryptography.hazmat.primitives import serialization
88

9+
logger = logging.getLogger(__name__)
10+
911
_DEFAULT_CONNECTION_FILE = "~/.snowsql/config"
1012

1113

@@ -106,7 +108,7 @@ def _load_from_snowsql_config_file(connection_name: str, login_file: str = "") -
106108
"""Loads the dictionary from snowsql config file."""
107109
snowsql_config_file = login_file if login_file else os.path.expanduser(_DEFAULT_CONNECTION_FILE)
108110
if not os.path.exists(snowsql_config_file):
109-
logging.error(f"Connection name given but snowsql config file is not found at: {snowsql_config_file}")
111+
logger.error(f"Connection name given but snowsql config file is not found at: {snowsql_config_file}")
110112
raise Exception("Snowflake SnowSQL config not found.")
111113

112114
config = configparser.ConfigParser(inline_comment_prefixes="#")
@@ -122,7 +124,7 @@ def _load_from_snowsql_config_file(connection_name: str, login_file: str = "") -
122124
# See https://docs.snowflake.com/en/user-guide/snowsql-start.html#configuring-default-connection-settings
123125
connection_name = "connections"
124126

125-
logging.info(f"Reading {snowsql_config_file} for connection parameters defined as {connection_name}")
127+
logger.info(f"Reading {snowsql_config_file} for connection parameters defined as {connection_name}")
126128
config.read(snowsql_config_file)
127129
conn_params = dict(config[connection_name])
128130
# Remap names to appropriate args in Python Connector API

snowflake/ml/_internal/utils/jwt_generator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,16 @@ def get_token(self) -> str:
110110
}
111111

112112
# Regenerate the actual token
113-
token = jwt.encode(payload, key=self.private_key, algorithm=JWTGenerator.ALGORITHM)
113+
token = jwt.encode(payload, key=self.private_key, algorithm=JWTGenerator.ALGORITHM) # type: ignore[arg-type]
114114
# If you are using a version of PyJWT prior to 2.0, jwt.encode returns a byte string instead of a string.
115115
# If the token is a byte string, convert it to a string.
116116
if isinstance(token, bytes):
117117
token = token.decode("utf-8")
118118
self.token = token
119+
public_key = self.private_key.public_key()
119120
logger.info(
120121
"Generated a JWT with the following payload: %s",
121-
jwt.decode(self.token, key=self.private_key.public_key(), algorithms=[JWTGenerator.ALGORITHM]),
122+
jwt.decode(self.token, key=public_key, algorithms=[JWTGenerator.ALGORITHM]), # type: ignore[arg-type]
122123
)
123124

124125
return token

snowflake/ml/_internal/utils/string_matcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import logging
12
import re
23

34
import sqlparse
4-
from absl.logging import logging
55

66
from snowflake.ml._internal.utils.formatting import unwrap
77

0 commit comments

Comments
 (0)