Releases: snowflakedb/snowflake-ml-python
1.8.1
1.8.1
Bug Fixes
- Registry: Fix a bug that caused
unsupported model type
error while logging a sklearn model withscore_samples
inference method. - Registry: Fix a bug that model inference service creation fails on an existing and suspended service.
Behavior Change
New Features
- ML Job (PrPr): Update Container Runtime image version to
1.0.1
- ML Job (PrPr): Add
enable_metrics
argument to job submission APIs to enable publishing service metrics to Event Table.
See Accessing Event Table service metrics
for retrieving published metrics
and Costs of telemetry data collection
for cost implications. - Registry: When creating a copy of a
ModelVersion
withlog_model
, raise an exception if unsupported arguments are provided.
1.8.0
1.8.0
Bug Fixes
- Modeling: Fix a bug in some metrics that allowed an unsupported version of numpy to be installed
automatically in the stored procedure, resulting in a numpy error on execution - Registry: Fix a bug that leads to incorrect
Model is does not have _is_inference_api
error message when assigning
a supported model as a property of a CustomModel. - Registry: Fix a bug that inference is not working when models with more than 500 input features
are deployed to SPCS.
Behavior Change
-
Registry: With FeatureGroupSpec support, auto inferred model signature for
transformers.Pipeline
models have been
updated, including:-
Signature for fill-mask task has been changed from
ModelSignature( inputs=[ FeatureSpec(name="inputs", dtype=DataType.STRING), ], outputs=[ FeatureSpec(name="outputs", dtype=DataType.STRING), ], )
to
ModelSignature( inputs=[ FeatureSpec(name="inputs", dtype=DataType.STRING), ], outputs=[ FeatureGroupSpec( name="outputs", specs=[ FeatureSpec(name="sequence", dtype=DataType.STRING), FeatureSpec(name="score", dtype=DataType.DOUBLE), FeatureSpec(name="token", dtype=DataType.INT64), FeatureSpec(name="token_str", dtype=DataType.STRING), ], shape=(-1,), ), ], )
-
Signature for token-classification task has been changed from
ModelSignature( inputs=[ FeatureSpec(name="inputs", dtype=DataType.STRING), ], outputs=[ FeatureSpec(name="outputs", dtype=DataType.STRING), ], )
to
ModelSignature( inputs=[FeatureSpec(name="inputs", dtype=DataType.STRING)], outputs=[ FeatureGroupSpec( name="outputs", specs=[ FeatureSpec(name="word", dtype=DataType.STRING), FeatureSpec(name="score", dtype=DataType.DOUBLE), FeatureSpec(name="entity", dtype=DataType.STRING), FeatureSpec(name="index", dtype=DataType.INT64), FeatureSpec(name="start", dtype=DataType.INT64), FeatureSpec(name="end", dtype=DataType.INT64), ], shape=(-1,), ), ], )
-
Signature for question-answering task when top_k is larger than 1 has been changed from
ModelSignature( inputs=[ FeatureSpec(name="question", dtype=DataType.STRING), FeatureSpec(name="context", dtype=DataType.STRING), ], outputs=[ FeatureSpec(name="outputs", dtype=DataType.STRING), ], )
to
ModelSignature( inputs=[ FeatureSpec(name="question", dtype=DataType.STRING), FeatureSpec(name="context", dtype=DataType.STRING), ], outputs=[ FeatureGroupSpec( name="answers", specs=[ FeatureSpec(name="score", dtype=DataType.DOUBLE), FeatureSpec(name="start", dtype=DataType.INT64), FeatureSpec(name="end", dtype=DataType.INT64), FeatureSpec(name="answer", dtype=DataType.STRING), ], shape=(-1,), ), ], )
-
Signature for text-classification task when top_k is
None
has been changed fromModelSignature( inputs=[ FeatureSpec(name="text", dtype=DataType.STRING), FeatureSpec(name="text_pair", dtype=DataType.STRING), ], outputs=[ FeatureSpec(name="label", dtype=DataType.STRING), FeatureSpec(name="score", dtype=DataType.DOUBLE), ], )
to
ModelSignature( inputs=[ FeatureSpec(name="text", dtype=DataType.STRING), ], outputs=[ FeatureSpec(name="label", dtype=DataType.STRING), FeatureSpec(name="score", dtype=DataType.DOUBLE), ], )
-
Signature for text-classification task when top_k is not
None
has been changed fromModelSignature( inputs=[ FeatureSpec(name="text", dtype=DataType.STRING), FeatureSpec(name="text_pair", dtype=DataType.STRING), ], outputs=[ FeatureSpec(name="outputs", dtype=DataType.STRING), ], )
to
ModelSignature( inputs=[ FeatureSpec(name="text", dtype=DataType.STRING), ], outputs=[ FeatureGroupSpec( name="labels", specs=[ FeatureSpec(name="label", dtype=DataType.STRING), FeatureSpec(name="score", dtype=DataType.DOUBLE), ], shape=(-1,), ), ], )
-
Signature for text-generation task has been changed from
ModelSignature( inputs=[FeatureSpec(name="inputs", dtype=DataType.STRING)], outputs=[ FeatureSpec(name="outputs", dtype=DataType.STRING), ], )
to
ModelSignature( inputs=[ FeatureGroupSpec( name="inputs", specs=[ FeatureSpec(name="role", dtype=DataType.STRING), FeatureSpec(name="content", dtype=DataType.STRING), ], shape=(-1,), ), ], outputs=[ FeatureGroupSpec( name="outputs", specs=[ FeatureSpec(name="generated_text", dtype=DataType.STRING), ], shape=(-1,), ) ], )
-
-
Registry: PyTorch and TensorFlow models now expect a single tensor input/output by default when logging to Model
Registry. To use multiple tensors (previous behavior), setoptions={"multiple_inputs": True}
.Example with single tensor input:
import torch class TorchModel(torch.nn.Module): def __init__(self, n_input: int, n_hidden: int, n_out: int, dtype: torch.dtype = torch.float32) -> None: super().__init__() self.model = torch.nn.Sequential( torch.nn.Linear(n_input, n_hidden, dtype=dtype), torch.nn.ReLU(), torch.nn.Linear(n_hidden, n_out, dtype=dtype), torch.nn.Sigmoid(), ) def forward(self, tensor: torch.Tensor) -> torch.Tensor: return cast(torch.Tensor, self.model(tensor)) # Sample usage: data_x = torch.rand(size=(batch_size, n_input)) # Log model with single tensor reg.log_model( model=model, ..., sample_input_data=data_x ) # Run inference with single tensor mv.run(data_x)
For multiple tensor inputs/outputs, use:
reg.log_model( model=model, ..., sample_input_data=[data_x_1, data_x_2], options={"multiple_inputs": True} )
-
Registry: Default
enable_explainability
to False when the model can be deployed to Snowpark Container Services.
New Features
- Registry: Added support to single
torch.Tensor
,tensorflow.Tensor
andtensorflow.Variable
as input or output
data. - Registry: Support
xgboost.DMatrix
datatype for XGBoost models.
1.7.5
1.7.5
- Support Python 3.12.
- Explainability: Support native and snowml sklearn pipeline
Bug Fixes
- Registry: Fixed a compatibility issue when using
snowflake-ml-python
1.7.0 or greater to save atensorflow.keras
model withkeras
2.x, ifrelax_version
is set or default to True, and newer version ofsnowflake-ml-python
is available in Snowflake Anaconda Channel, model could not be run in Snowflake. If you have such model, you could
use the latest version ofsnowflake-ml-python
and callModelVersion.load
to load it back, and re-log it.
Alternatively, you can prevent this issue by settingrelax_version=False
when saving the model. - Registry: Removed the validation that disallows data that does not have non-null values being passed to
ModelVersion.run
. - ML Job (PrPr): No longer require CREATE STAGE privilege if
stage_name
points to an existing stage - ML Job (PrPr): Fixed a bug causing some payload source and entrypoint path
combinations to be erroneously rejected with
ValueError(f"{self.entrypoint} must be a subpath of {self.source}")
- ML Job (PrPr): Fixed a bug in Ray cluster startup config which caused certain Runtime APIs to fail
Behavior Change
New Features
- Registry: Added support for handling Hugging Face model configurations with auto-mapping functionality.
- Registry: Added support for
keras
3.x model withtensorflow
andpytorch
backend - ML Job (PrPr): Support any serializable (pickleable) argument for
@remote
decorated functions
1.7.4
1.7.4
- FileSet: The
snowflake.ml.fileset.FileSet
has been deprecated and will be removed in a future version.
Use snowflake.ml.dataset.Dataset and
snowflake.ml.data.DataConnector
instead.
Bug Fixes
- Registry: Fixed an issue that the hugging face pipeline is loaded using incorrect dtype.
- Registry: Fixed an issue that only 1 row is used when infer the model signature in the modeling model.
Behavior Changes
- Registry:
ModelVersion.run
on a service would require redeploying the service once account opts into nested function.
New Features
- Add new
snowflake.ml.jobs
preview API for running headless workloads on SPCS using
Container Runtime for ML - Added
guardrails
option to Cortexcomplete
function, enabling
Cortex Guard support
1.7.3
1.7.3
- Added lowercase versions of Cortex functions, added deprecation warning to Capitalized versions.
- Bumped the requirements of
fsspec
ands3fs
to>=2024.6.1,<2026
- Bumped the requirement of
mlflow
to>=2.16.0, <3
- Registry: Support 500+ features for model registry
Bug Fixes
- Registry: Fixed a bug when providing non-range index pandas DataFrame as the input to a
ModelVersion.run
. - Registry: Improved random model version name generation to prevent collisions.
- Registry: Fix an issue when inferring signature or running inference with Snowpark data that has a column whose type
isARRAY
and containsNULL
value. - Registry:
ModelVersion.run
now accepts fully qualified service name. - Monitoring: Fix issue in SDK with creating monitors using fully qualified names.
- Registry: Fix error in log_model for any sklearn models with only data pre-processing including pre-processing only
pipeline models due to default explainability enablement.
Behavior Changes
New Features
- Added
user_files
argument toRegistry.log_model
for including images or any extra file with the model. - Registry: Added support for handling Hugging Face model configurations with auto-mapping functionality
- DataConnector: Add new
DataConnector.from_sql()
constructor
1.7.2
1.7.2
Bug Fixes
- Model Explainability: Fix issue that explain is enabled for scikit-learn pipeline
whose task is UNKNOWN and fails later when invoked.
Behavior Changes
New Features
- Registry: Support asynchronous model inference service creation with the
block
option
inModelVersion.create_service()
set to True by default.
1.7.1
1.7.1
Bug Fixes
- Registry: Null value is now allowed in the dataframe used in model signature inference. Null values will be ignored
and others will be used to infer the signature. - Registry: Pandas Extension DTypes (
pandas.StringDType()
,pandas.BooleanDType()
, etc.) are now supported in model
signature inference. - Registry: Null value is now allowed in the dataframe used to predict.
- Data: Fix missing
snowflake.ml.data.*
module exports in wheel - Dataset: Fix missing
snowflake.ml.dataset.*
module exports in wheel. - Registry: Fix the issue that
tf_keras.Model
is not recognized as keras model when logging.
Behavior Changes
New Features
- Registry: Option to
enable_monitoring
set to False by default. This will gate access to preview features of Model Monitoring. - Model Monitoring:
show_model_monitors
Registry method. This feature is still in Private Preview. - Registry: Support
pd.Series
in input and output data. - Model Monitoring:
add_monitor
Registry method. This feature is still in Private Preview. - Model Monitoring:
resume
andsuspend
ModelMonitor. This feature is still in Private Preview. - Model Monitoring:
get_monitor
Registry method. This feature is still in Private Preview. - Model Monitoring:
delete_monitor
Registry method. This feature is still in Private Preview.
1.7.0
1.7.0
Behavior Change
- Generic: Require python >= 3.9.
- Data Connector: Update
to_torch_dataset
andto_torch_datapipe
to add a dimension for scalar data.
This allows for more seamless integration with PyTorchDataLoader
, which creates batches by stacking inputs of each batch.
Examples:
ds = connector.to_torch_dataset(shuffle=False, batch_size=3)
-
Input: "col1": [10, 11, 12]
- Previous batch: array([10., 11., 12.]) with shape (3,)
- New batch: array([[10.], [11.], [12.]]) with shape (3, 1)
-
Input: "col2": [[0, 100], [1, 110], [2, 200]]
- Previous batch: array([[ 0, 100], [ 1, 110], [ 2, 200]]) with shape (3,2)
- New batch: No change
-
Model Registry: External access integrations are optional when creating a model inference service in
Snowflake >= 8.40.0. -
Model Registry: Deprecate
build_external_access_integration
withbuild_external_access_integrations
in
ModelVersion.create_service()
.
Bug Fixes
- Registry: Updated
log_model
API to accept both signature and sample_input_data parameters. - Feature Store: ExampleHelper uses fully qualified path for table name. change weather features aggregation from 1d to 1h.
- Data Connector: Return numpy array with appropriate object type instead of list for multi-dimensional
data fromto_torch_dataset
andto_torch_datapipe
- Model explainability: Incompatibility between SHAP 0.42.1 and XGB 2.1.1 resolved by using latest SHAP 0.46.0.
New Features
- Registry: Provide pass keyworded variable length of arguments to class ModelContext. Example usage:
mc = custom_model.ModelContext(
config = 'local_model_dir/config.json',
m1 = model1
)
class ExamplePipelineModel(custom_model.CustomModel):
def __init__(self, context: custom_model.ModelContext) -> None:
super().__init__(context)
v = open(self.context['config']).read()
self.bias = json.loads(v)['bias']
@custom_model.inference_api
def predict(self, input: pd.DataFrame) -> pd.DataFrame:
model_output = self.context['m1'].predict(input)
return pd.DataFrame({'output': model_output + self.bias})
- Model Development: Upgrade scikit-learn in UDTF backend for log_loss metric. As a result,
eps
argument is now ignored. - Data Connector: Add the option of passing a
None
sized batch toto_torch_dataset
for better
interoperability with PyTorch DataLoader. - Model Registry: Support pandas.CategoricalDtype
- Registry: It is now possible to pass
signatures
andsample_input_data
at the same time to capture background
data from explainablity and data lineage.
1.6.4
1.6.4
Bug Fixes
- Registry: Fix an issue that leads to incident when using
ModelVersion.run
with service.
1.6.3
1.6.3
- Model Registry (PrPr) has been removed.
Bug Fixes
- Registry: Fix a bug that when package whose name does not follow PEP-508 is provided when logging the model,
an unexpected normalization is happening. - Registry: Fix
not a valid remote uri
error when logging mlflow models. - Registry: Fix a bug that
ModelVersion.run
is called in a nested way. - Registry: Fix an issue that leads to
log_model
failure when local package version contains parts other than
base version.
New Features
- Data: Improve
DataConnector.to_pandas()
performance when loading from Snowpark DataFrames. - Model Registry: Allow users to set a model task while using
log_model
. - Feature Store: FeatureView supports ON_CREATE or ON_SCHEDULE initialize mode.