Skip to content

Commit abe5b67

Browse files
sfc-gh-kdamaSnowflake Authors
andauthored
Release Snowflake-ml-python 1.1.0 (#72)
Co-authored-by: Snowflake Authors <[email protected]>
1 parent b938743 commit abe5b67

File tree

183 files changed

+8267
-3100
lines changed

Some content is hidden

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

183 files changed

+8267
-3100
lines changed

.flake8

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ max_line_length=120
2222
; E731: Do not assign a lambda expression, use a def (E731) https://www.flake8rules.com/rules/E731.html
2323
; F821: Undefined name name (F821) https://www.flake8rules.com/rules/F821.html
2424
; W504: Line break occurred after a binary operator (W504) https://www.flake8rules.com/rules/W504.html
25+
; T2xx: Use print https://github.com/jbkahn/flake8-print
2526

2627
extend-ignore=E203
27-
exclude=build,setup,tool,.tox,connector_python3,parameters.py"
28+
exclude=build,setup,tool,.tox,connector_python3,parameters.py
29+
per-file-ignores =
30+
tests/*: T2

.pre-commit-config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ repos:
4545
- jupyter
4646
exclude: (?x)^(\.vscode\-bootstrap/.*\.json)$
4747
- repo: https://github.com/pycqa/flake8 # config: .flake8
48-
rev: 3.9.2
48+
rev: 6.1.0
4949
hooks:
5050
- id: flake8
5151
additional_dependencies:
52-
- flake8-bugbear == 20.11.1
52+
- flake8-bugbear == 23.9.16
5353
- flake8-init-return == 1.0.0
54+
- flake8-print == 5.0.0
5455
- repo: https://github.com/terrencepreilly/darglint
5556
rev: v1.7.0
5657
hooks:

CHANGELOG.md

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

3+
## 1.1.0
4+
5+
### Bug Fixes
6+
7+
- Model Registry: Fix panda dataframe input not handling first row properly.
8+
- Model Development: OrdinalEncoder and LabelEncoder output_columns do not need to be valid snowflake identifiers. They
9+
would previously be excluded if the normalized name did not match the name specified in output_columns.
10+
11+
### Behavior Changes
12+
13+
### New Features
14+
15+
- Model Registry: Add support for invoking public endpoint on SPCS service, by providing a "enable_ingress" SPCS
16+
deployment option.
17+
- Model Development: Add support for distributed HPO - GridSearchCV and RandomizedSearchCV execution will be
18+
distributed on multi-node warehouses.
19+
320
## 1.0.12
421

522
### Bug Fixes
623

724
- Model Registry: Fix regression issue that container logging is not shown during model deployment to SPCS.
825
- Model Development: Enhance the column capacity of OrdinalEncoder.
9-
- Model Registry: Fix unbound `batch_size`` error when deploying a model other than Hugging Face Pipeline
26+
- Model Registry: Fix unbound `batch_size` error when deploying a model other than Hugging Face Pipeline
1027
and LLM with GPU on SPCS.
1128

1229
### Behavior Changes

CONTRIBUTING.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ available in `conda` only. You can also set this along with `dev_version_pypi` i
246246

247247
(At least one of these three fields should be set.)
248248

249+
`require_gpu`: Set this to true if the package is only a requirement for the environment with GPUs.
250+
249251
#### Snowflake Anaconda Channel
250252

251253
`from_channel`: Set this if the package is not available in the Snowflake Anaconda Channel
@@ -357,17 +359,15 @@ To test if your code is working in store procedure or not simply, you could work
357359

358360
To write a such test, you need to
359361

362+
1. Your test cannot have a parameter called `_sproc_test_mode`.
360363
1. Let your test case inherit from `common_test_base.CommonTestBase`.
361364
1. Remove all Snowpark Session creation in your test, and use `self.session` to access the session if needed.
362-
1. If you write your own `setUp` and `tearDown` method, remember to call `super().setUp()` or `super().tearDown().`
365+
1. If you write your own `setUp` and `tearDown` method, remember to call `super().setUp()` or
366+
`super().tearDown()`.
363367
1. Decorate your test method with `common_test_base.CommonTestBase.sproc_test()`. If you want your test running in
364368
store procedure only rather than both locally and in store procedure, set `local=False`. If you don't want to test
365369
with caller's rights, set `test_callers_rights=False`. (Owner's rights store procedure is always tested)
366370

367-
**Attention**: Depending on your configurations, 1-3 sub-tests will be run in your test method.
368-
Sub-test means that `setUp` and `tearDown` won't run every sub-test and will only run once before and
369-
after the whole test method. So it is important to make your test case self-contained.
370-
371371
### Compatibility Test
372372

373373
To test if your code is compatible with previous version simply, you could work based on `CommonTestBase` in
@@ -376,9 +376,11 @@ To test if your code is compatible with previous version simply, you could work
376376

377377
To write a such test, you need to
378378

379+
1. Your test cannot have a parameter called `_snowml_pkg_ver`.
379380
1. Let your test case inherit from `common_test_base.CommonTestBase`.
380381
1. Remove all Snowpark Session creation in your test, and use `self.session` to access the session if needed.
381-
1. If you write your own `setUp` and `tearDown` method, remember to call `super().setUp()` or `super().tearDown().`
382+
1. If you write your own `setUp` and `tearDown` method, remember to call `super().setUp()` or
383+
`super().tearDown()`.
382384
1. Write a factory method in your test class that return a tuple of a function and its parameters as a tuple. The
383385
function will be run as a store procedure in the environment with previous version of library.
384386

@@ -393,11 +395,6 @@ function will be run as a store procedure in the environment with previous versi
393395
1. Decorate your test method with `common_test_base.CommonTestBase.compatibility_test`, providing the factory method
394396
you created in the above step, optional version range to test with, as well as additional package requirements.
395397

396-
**Attention**: For every version available in the server and within the version range, a sub-test will be run that
397-
contains a run of prepare function in the store procedure and a run of the method. Sub-test means that `setUp` and
398-
`tearDown` won't run every sub-test and will only run once before and after the whole test method. So it is
399-
important to make your test case self-contained.
400-
401398
## `pre-commit`
402399

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

bazel/environments/conda-env-snowflake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ dependencies:
4343
- sentencepiece==0.1.99
4444
- shap==0.42.1
4545
- snowflake-connector-python==3.2.0
46-
- snowflake-snowpark-python==1.6.1
46+
- snowflake-snowpark-python==1.8.0
4747
- sphinx==5.0.2
4848
- sqlparse==0.4.4
4949
- tensorflow==2.10.0

bazel/environments/conda-env.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dependencies:
4848
- sentencepiece==0.1.99
4949
- shap==0.42.1
5050
- snowflake-connector-python==3.2.0
51-
- snowflake-snowpark-python==1.6.1
51+
- snowflake-snowpark-python==1.8.0
5252
- sphinx==5.0.2
5353
- sqlparse==0.4.4
5454
- tensorflow==2.10.0
@@ -63,4 +63,3 @@ dependencies:
6363
- pip:
6464
- --extra-index-url https://pypi.org/simple
6565
- peft==0.5.0
66-
- vllm==0.2.1.post1

bazel/environments/conda-gpu-env.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ dependencies:
5050
- sentencepiece==0.1.99
5151
- shap==0.42.1
5252
- snowflake-connector-python==3.2.0
53-
- snowflake-snowpark-python==1.6.1
53+
- snowflake-snowpark-python==1.8.0
5454
- sphinx==5.0.2
5555
- sqlparse==0.4.4
5656
- tensorflow==2.10.0

bazel/filter_affected_targets.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

bazel/requirements/parse_and_generate_requirements.py

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class RequirementInfo(TypedDict, total=False):
4949
version_requirements: str
5050
version_requirements_pypi: str
5151
version_requirements_conda: str
52+
require_gpu: bool
5253
requirements_extra_tags: Sequence[str]
5354
tags: Sequence[str]
5455

@@ -67,7 +68,7 @@ def filter_by_tag(
6768
tag_filter: tag to filter the requirement. Defaults to None.
6869
6970
Returns:
70-
True if tag_filter is None, or in the array of given field if presented.
71+
True if tag_filter is None, or in the array of given field in presented.
7172
"""
7273
return tag_filter is None or tag_filter in req_info.get(field, [])
7374

@@ -100,6 +101,7 @@ def get_req_name(req_info: RequirementInfo, env: Literal["conda", "pip", "conda-
100101
req_info: requirement information.
101102
env: environment indicator, choose from conda and pip.
102103
104+
103105
Raises:
104106
ValueError: Illegal env argument.
105107
@@ -123,14 +125,15 @@ def get_req_name(req_info: RequirementInfo, env: Literal["conda", "pip", "conda-
123125

124126

125127
def generate_dev_pinned_string(
126-
req_info: RequirementInfo, env: Literal["conda", "pip", "conda-only", "pip-only"]
128+
req_info: RequirementInfo, env: Literal["conda", "pip", "conda-only", "pip-only"], has_gpu: bool = False
127129
) -> Optional[str]:
128130
"""Get the pinned version for dev environment of the requirement in the given env.
129131
For each env, env specific pinned version will be chosen, if not presented, common pinned version will be chosen.
130132
131133
Args:
132134
req_info: requirement information.
133135
env: environment indicator, choose from conda and pip.
136+
has_gpu: If the environment has GPU, present to filter require required GPU package.
134137
135138
Raises:
136139
ValueError: Illegal env argument.
@@ -143,6 +146,8 @@ def generate_dev_pinned_string(
143146
name = get_req_name(req_info, env)
144147
if name is None:
145148
return None
149+
if not has_gpu and req_info.get("require_gpu", False):
150+
return None
146151
if env.startswith("conda"):
147152
version = req_info.get("dev_version_conda", req_info.get("dev_version", None))
148153
if version is None:
@@ -348,7 +353,7 @@ def generate_requirements(
348353
filter(
349354
None,
350355
map(
351-
lambda req_info: generate_dev_pinned_string(req_info, "conda"),
356+
lambda req_info: generate_dev_pinned_string(req_info, "conda", has_gpu=(mode == "dev_gpu_version")),
352357
filter(
353358
lambda req_info: req_info.get("from_channel", SNOWFLAKE_CONDA_CHANNEL)
354359
== SNOWFLAKE_CONDA_CHANNEL,
@@ -359,7 +364,15 @@ def generate_requirements(
359364
)
360365
)
361366
extended_env_conda = list(
362-
sorted(filter(None, map(lambda req_info: generate_dev_pinned_string(req_info, "conda"), requirements)))
367+
sorted(
368+
filter(
369+
None,
370+
map(
371+
lambda req_info: generate_dev_pinned_string(req_info, "conda", has_gpu=(mode == "dev_gpu_version")),
372+
requirements,
373+
),
374+
)
375+
)
363376
)
364377

365378
extended_env: List[Union[str, MutableMapping[str, Sequence[str]]]] = copy.deepcopy(
@@ -370,7 +383,13 @@ def generate_requirements(
370383
# while for internal pip-only packages, nexus is the only viable index.
371384
# Relative order is here to prevent nexus index overriding public index.
372385
pip_only_reqs = list(
373-
filter(None, map(lambda req_info: generate_dev_pinned_string(req_info, "pip-only"), requirements))
386+
filter(
387+
None,
388+
map(
389+
lambda req_info: generate_dev_pinned_string(req_info, "pip-only", has_gpu=(mode == "dev_gpu_version")),
390+
requirements,
391+
),
392+
)
374393
)
375394
if pip_only_reqs:
376395
extended_env.extend(["pip", {"pip": pip_only_reqs}])
@@ -383,7 +402,15 @@ def generate_requirements(
383402
sorted(
384403
map(
385404
lambda s: s + "\n",
386-
filter(None, map(lambda req_info: generate_dev_pinned_string(req_info, "pip"), requirements)),
405+
filter(
406+
None,
407+
map(
408+
lambda req_info: generate_dev_pinned_string(
409+
req_info, "pip", has_gpu=(mode == "dev_gpu_version")
410+
),
411+
requirements,
412+
),
413+
),
387414
)
388415
)
389416
)

bazel/requirements/requirements.schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@
6464
"description": "The channel where the package come from, set if not from Snowflake Anaconda Channel.",
6565
"type": "string"
6666
},
67+
"gpu_only": {
68+
"default": false,
69+
"description": "The package is required when running in an environment where GPU is available.",
70+
"type": "boolean"
71+
},
6772
"name": {
6873
"description": "The name of the required packages.",
6974
"type": "string"
@@ -90,6 +95,9 @@
9095
{
9196
"enum": [
9297
"deployment_core",
98+
"udf_inference",
99+
"spcs_inference",
100+
"model_packaging",
93101
"build_essential"
94102
],
95103
"type": "string"

0 commit comments

Comments
 (0)