Skip to content

Commit 9709d06

Browse files
sfc-gh-anavalosSnowflake Authors
andauthored
Project import generated by Copybara. (#148)
GitOrigin-RevId: fff2865353d805e86c35abc970949424d1c07833 Co-authored-by: Snowflake Authors <[email protected]>
1 parent 3e7b66c commit 9709d06

File tree

145 files changed

+5128
-863
lines changed

Some content is hidden

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

145 files changed

+5128
-863
lines changed

CHANGELOG.md

Lines changed: 279 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,286 @@
11
# Release History
22

3-
## 1.7.5
3+
## 1.8.0
4+
5+
### Bug Fixes
6+
7+
- Modeling: Fix a bug in some metrics that allowed an unsupported version of numpy to be installed
8+
automatically in the stored procedure, resulting in a numpy error on execution
9+
- Registry: Fix a bug that leads to incorrect `Model is does not have _is_inference_api` error message when assigning
10+
a supported model as a property of a CustomModel.
11+
- Registry: Fix a bug that inference is not working when models with more than 500 input features
12+
are deployed to SPCS.
13+
14+
### Behavior Change
15+
16+
- Registry: With FeatureGroupSpec support, auto inferred model signature for `transformers.Pipeline` models have been
17+
updated, including:
18+
- Signature for fill-mask task has been changed from
19+
20+
```python
21+
ModelSignature(
22+
inputs=[
23+
FeatureSpec(name="inputs", dtype=DataType.STRING),
24+
],
25+
outputs=[
26+
FeatureSpec(name="outputs", dtype=DataType.STRING),
27+
],
28+
)
29+
```
30+
31+
to
32+
33+
```python
34+
ModelSignature(
35+
inputs=[
36+
FeatureSpec(name="inputs", dtype=DataType.STRING),
37+
],
38+
outputs=[
39+
FeatureGroupSpec(
40+
name="outputs",
41+
specs=[
42+
FeatureSpec(name="sequence", dtype=DataType.STRING),
43+
FeatureSpec(name="score", dtype=DataType.DOUBLE),
44+
FeatureSpec(name="token", dtype=DataType.INT64),
45+
FeatureSpec(name="token_str", dtype=DataType.STRING),
46+
],
47+
shape=(-1,),
48+
),
49+
],
50+
)
51+
```
52+
53+
- Signature for token-classification task has been changed from
54+
55+
```python
56+
ModelSignature(
57+
inputs=[
58+
FeatureSpec(name="inputs", dtype=DataType.STRING),
59+
],
60+
outputs=[
61+
FeatureSpec(name="outputs", dtype=DataType.STRING),
62+
],
63+
)
64+
```
65+
66+
to
67+
68+
```python
69+
ModelSignature(
70+
inputs=[FeatureSpec(name="inputs", dtype=DataType.STRING)],
71+
outputs=[
72+
FeatureGroupSpec(
73+
name="outputs",
74+
specs=[
75+
FeatureSpec(name="word", dtype=DataType.STRING),
76+
FeatureSpec(name="score", dtype=DataType.DOUBLE),
77+
FeatureSpec(name="entity", dtype=DataType.STRING),
78+
FeatureSpec(name="index", dtype=DataType.INT64),
79+
FeatureSpec(name="start", dtype=DataType.INT64),
80+
FeatureSpec(name="end", dtype=DataType.INT64),
81+
],
82+
shape=(-1,),
83+
),
84+
],
85+
)
86+
```
87+
88+
- Signature for question-answering task when top_k is larger than 1 has been changed from
89+
90+
```python
91+
ModelSignature(
92+
inputs=[
93+
FeatureSpec(name="question", dtype=DataType.STRING),
94+
FeatureSpec(name="context", dtype=DataType.STRING),
95+
],
96+
outputs=[
97+
FeatureSpec(name="outputs", dtype=DataType.STRING),
98+
],
99+
)
100+
```
101+
102+
to
103+
104+
```python
105+
ModelSignature(
106+
inputs=[
107+
FeatureSpec(name="question", dtype=DataType.STRING),
108+
FeatureSpec(name="context", dtype=DataType.STRING),
109+
],
110+
outputs=[
111+
FeatureGroupSpec(
112+
name="answers",
113+
specs=[
114+
FeatureSpec(name="score", dtype=DataType.DOUBLE),
115+
FeatureSpec(name="start", dtype=DataType.INT64),
116+
FeatureSpec(name="end", dtype=DataType.INT64),
117+
FeatureSpec(name="answer", dtype=DataType.STRING),
118+
],
119+
shape=(-1,),
120+
),
121+
],
122+
)
123+
```
124+
125+
- Signature for text-classification task when top_k is `None` has been changed from
126+
127+
```python
128+
ModelSignature(
129+
inputs=[
130+
FeatureSpec(name="text", dtype=DataType.STRING),
131+
FeatureSpec(name="text_pair", dtype=DataType.STRING),
132+
],
133+
outputs=[
134+
FeatureSpec(name="label", dtype=DataType.STRING),
135+
FeatureSpec(name="score", dtype=DataType.DOUBLE),
136+
],
137+
)
138+
```
139+
140+
to
141+
142+
```python
143+
ModelSignature(
144+
inputs=[
145+
FeatureSpec(name="text", dtype=DataType.STRING),
146+
],
147+
outputs=[
148+
FeatureSpec(name="label", dtype=DataType.STRING),
149+
FeatureSpec(name="score", dtype=DataType.DOUBLE),
150+
],
151+
)
152+
```
153+
154+
- Signature for text-classification task when top_k is not `None` has been changed from
155+
156+
```python
157+
ModelSignature(
158+
inputs=[
159+
FeatureSpec(name="text", dtype=DataType.STRING),
160+
FeatureSpec(name="text_pair", dtype=DataType.STRING),
161+
],
162+
outputs=[
163+
FeatureSpec(name="outputs", dtype=DataType.STRING),
164+
],
165+
)
166+
```
167+
168+
to
169+
170+
```python
171+
ModelSignature(
172+
inputs=[
173+
FeatureSpec(name="text", dtype=DataType.STRING),
174+
],
175+
outputs=[
176+
FeatureGroupSpec(
177+
name="labels",
178+
specs=[
179+
FeatureSpec(name="label", dtype=DataType.STRING),
180+
FeatureSpec(name="score", dtype=DataType.DOUBLE),
181+
],
182+
shape=(-1,),
183+
),
184+
],
185+
)
186+
```
187+
188+
- Signature for text-generation task has been changed from
189+
190+
```python
191+
ModelSignature(
192+
inputs=[FeatureSpec(name="inputs", dtype=DataType.STRING)],
193+
outputs=[
194+
FeatureSpec(name="outputs", dtype=DataType.STRING),
195+
],
196+
)
197+
```
198+
199+
to
200+
201+
```python
202+
ModelSignature(
203+
inputs=[
204+
FeatureGroupSpec(
205+
name="inputs",
206+
specs=[
207+
FeatureSpec(name="role", dtype=DataType.STRING),
208+
FeatureSpec(name="content", dtype=DataType.STRING),
209+
],
210+
shape=(-1,),
211+
),
212+
],
213+
outputs=[
214+
FeatureGroupSpec(
215+
name="outputs",
216+
specs=[
217+
FeatureSpec(name="generated_text", dtype=DataType.STRING),
218+
],
219+
shape=(-1,),
220+
)
221+
],
222+
)
223+
```
224+
225+
- Registry: PyTorch and TensorFlow models now expect a single tensor input/output by default when logging to Model
226+
Registry. To use multiple tensors (previous behavior), set `options={"multiple_inputs": True}`.
227+
228+
Example with single tensor input:
229+
230+
```python
231+
import torch
232+
233+
class TorchModel(torch.nn.Module):
234+
def __init__(self, n_input: int, n_hidden: int, n_out: int, dtype: torch.dtype = torch.float32) -> None:
235+
super().__init__()
236+
self.model = torch.nn.Sequential(
237+
torch.nn.Linear(n_input, n_hidden, dtype=dtype),
238+
torch.nn.ReLU(),
239+
torch.nn.Linear(n_hidden, n_out, dtype=dtype),
240+
torch.nn.Sigmoid(),
241+
)
242+
243+
def forward(self, tensor: torch.Tensor) -> torch.Tensor:
244+
return cast(torch.Tensor, self.model(tensor))
245+
246+
# Sample usage:
247+
data_x = torch.rand(size=(batch_size, n_input))
248+
249+
# Log model with single tensor
250+
reg.log_model(
251+
model=model,
252+
...,
253+
sample_input_data=data_x
254+
)
255+
256+
# Run inference with single tensor
257+
mv.run(data_x)
258+
```
259+
260+
For multiple tensor inputs/outputs, use:
261+
262+
```python
263+
reg.log_model(
264+
model=model,
265+
...,
266+
sample_input_data=[data_x_1, data_x_2],
267+
options={"multiple_inputs": True}
268+
)
269+
```
270+
271+
- Registry: Default `enable_explainability` to False when the model can be deployed to Snowpark Container Services.
272+
273+
### New Features
274+
275+
- Registry: Added support to single `torch.Tensor`, `tensorflow.Tensor` and `tensorflow.Variable` as input or output
276+
data.
277+
- Registry: Support [`xgboost.DMatrix`](https://xgboost.readthedocs.io/en/stable/python/python_api.html#xgboost.DMatrix)
278+
datatype for XGBoost models.
279+
280+
## 1.7.5 (03-06-2025)
4281

5282
- Support Python 3.12.
6-
- Explainability: Support native and snowml sklearn pipeline
283+
- Explainability: Support native and snowflake.ml.modeling sklearn pipeline
7284

8285
### Bug Fixes
9286

@@ -20,8 +297,6 @@
20297
`ValueError(f"{self.entrypoint} must be a subpath of {self.source}")`
21298
- ML Job (PrPr): Fixed a bug in Ray cluster startup config which caused certain Runtime APIs to fail
22299

23-
### Behavior Change
24-
25300
### New Features
26301

27302
- Registry: Added support for handling Hugging Face model configurations with auto-mapping functionality.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ For example, to run all autogenerated tests locally:
161161

162162
```sh
163163
# Then run all autogenerated tests
164-
bazel test //... --test_tag_filters=autogen
164+
bazel test //... --test_tag_filters=autogen --config=core
165165
```
166166

167167
### Coverage

bazel/environments/conda-env-all.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ dependencies:
5454
- sentence-transformers==2.7.0
5555
- sentencepiece==0.1.99
5656
- shap==0.46.0
57-
- snowflake-connector-python==3.10.0
58-
- snowflake-snowpark-python==1.17.0
57+
- snowflake-connector-python==3.12.0
58+
- snowflake-snowpark-python==1.28.0
5959
- sphinx==5.0.2
6060
- sqlparse==0.4.4
6161
- starlette==0.27.0
6262
- tensorflow==2.17.0
6363
- tokenizers==0.15.1
6464
- toml==0.10.2
6565
- torchdata==0.6.1
66-
- transformers==4.37.2
66+
- transformers==4.39.3
6767
- types-PyYAML==6.0.12.12
6868
- types-protobuf==4.23.0.1
6969
- types-requests==2.30.0.0

bazel/environments/conda-env-core.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ dependencies:
4646
- s3fs==2024.6.1
4747
- scikit-learn==1.5.1
4848
- scipy==1.10.1
49-
- snowflake-connector-python==3.10.0
50-
- snowflake-snowpark-python==1.17.0
49+
- snowflake-connector-python==3.12.0
50+
- snowflake-snowpark-python==1.28.0
5151
- sphinx==5.0.2
5252
- sqlparse==0.4.4
5353
- starlette==0.27.0

bazel/environments/conda-env-keras.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ dependencies:
4848
- s3fs==2024.6.1
4949
- scikit-learn==1.5.1
5050
- scipy==1.10.1
51-
- snowflake-connector-python==3.10.0
52-
- snowflake-snowpark-python==1.17.0
51+
- snowflake-connector-python==3.12.0
52+
- snowflake-snowpark-python==1.28.0
5353
- sphinx==5.0.2
5454
- sqlparse==0.4.4
5555
- starlette==0.27.0

bazel/environments/conda-env-ml.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ dependencies:
5050
- scikit-learn==1.5.1
5151
- scipy==1.10.1
5252
- shap==0.46.0
53-
- snowflake-connector-python==3.10.0
54-
- snowflake-snowpark-python==1.17.0
53+
- snowflake-connector-python==3.12.0
54+
- snowflake-snowpark-python==1.28.0
5555
- sphinx==5.0.2
5656
- sqlparse==0.4.4
5757
- starlette==0.27.0

bazel/environments/conda-env-torch.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ dependencies:
5050
- scipy==1.10.1
5151
- sentence-transformers==2.7.0
5252
- sentencepiece==0.1.99
53-
- snowflake-connector-python==3.10.0
54-
- snowflake-snowpark-python==1.17.0
53+
- snowflake-connector-python==3.12.0
54+
- snowflake-snowpark-python==1.28.0
5555
- sphinx==5.0.2
5656
- sqlparse==0.4.4
5757
- starlette==0.27.0
5858
- tokenizers==0.15.1
5959
- toml==0.10.2
6060
- torchdata==0.6.1
61-
- transformers==4.37.2
61+
- transformers==4.39.3
6262
- types-PyYAML==6.0.12.12
6363
- types-protobuf==4.23.0.1
6464
- types-requests==2.30.0.0

bazel/environments/conda-optional-dependency-torch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ channels:
88
dependencies:
99
- mlflow>=2.16.0, <3
1010
- pytorch>=2.0.1,<3
11-
- sentence-transformers>=2.7.0,<3
11+
- sentence-transformers>=2.7.0,<4
1212
- sentencepiece>=0.1.95,<0.2.0
1313
- tokenizers>=0.15.1,<1
1414
- torchdata>=0.4,<1
15-
- transformers>=4.37.2,<5
15+
- transformers>=4.39.3,<5

0 commit comments

Comments
 (0)