-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Init MLflow support #2
Merged
Merged
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
3c62ef5
Init MLflow support
mwiewior a22d632
Fixing linters
mwiewior 2d0d397
Addin support in starter
mwiewior 150a48d
Fix for isort
mwiewior 54f5b60
Fixing Unit tests
mwiewior 6e91f0f
Fixing Unit tests
mwiewior b5c3947
Fixing ut linting
mwiewior 5d65a8b
Applying comments
mwiewior 7435c6e
Passing mlflow config
mwiewior 9480fe1
mlflow stage_name
mwiewior 7349e15
mlflow stage_name
mwiewior c880eb5
mlflow stage_name
mwiewior 83dcd45
Adding mlflow_helpers
mwiewior 6daf8d2
Fixing stage name
mwiewior 115a60d
Removing eval
mwiewior 5d64d40
Adding pipeline name to each task/node
mwiewior 94647ca
Docs update
mwiewior acccc84
Doc for implementation details
mwiewior 7dc2061
UDF inference
mwiewior 57abf33
Adding run finalizer hook
mwiewior 85eea44
Starter updates for MLflow
mwiewior d81b84d
Fixes for metrics and model upload
mwiewior 013522f
Jinja cookie cutting corrections for mlflow enablement
Lasica 2c31cc3
limiting kedro version to 0.18.8 because of dataset bugs
Lasica ddc021b
removed extra _ in name
Lasica f70bc4b
Un-hardcode MLflow config
marrrcin 062273e
fix calling mlflow procedure
Lasica efec3dc
fixing mlflow task name
Lasica f223c07
updated docs
Lasica 99674ae
changelog
Lasica d44034c
added spellcheck to precommit, fixed spellcheck issues
Lasica 637c73a
docs: updated placeholder
Lasica 9d0a63b
refactor: fixed typo in function name
Lasica 5ec874d
refactor: Changed enable mlflow param to allow lowercase
Lasica b506515
docs: added link to mlflow snowflake integration
Lasica 587b848
docs: fix syntax highlight
Lasica 84335f7
Merge branch 'develop' into feature/mlflow-support
Lasica 9d990f9
docs: spellcheck dict
Lasica File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# [Beta] MLflow support | ||
|
||
## High level architecture | ||
The key challenge is to provide access to the external service endpoints (like MLflow) | ||
that is currently not yet supported natively in Snowpark (External Access feature is on the Snowflake roadmap). Snowflake external | ||
functions are the preferred workaround. | ||
![MLflow and Kedro-snowflake](../images/mlflow-support.png) | ||
|
||
## Implementation details | ||
Kedro-Snowflake <-> MLflow integration is based on the following concepts: | ||
* [Snowflake external functions](https://docs.snowflake.com/en/sql-reference/external-functions-introduction) that | ||
are used for wrapping POST requests to the MLflow instance. In the minimal setup the following wrapping external functions for MLflow REST API calls must be created: | ||
* [Create run](https://mlflow.org/docs/latest/rest-api.html#create-run) | ||
* [Update run](https://mlflow.org/docs/latest/rest-api.html#update-run) | ||
* [Log param](https://mlflow.org/docs/latest/rest-api.html#log-param) | ||
* [Log metric](https://mlflow.org/docs/latest/rest-api.html#log-metric) | ||
* [Search experiment](https://mlflow.org/docs/latest/rest-api.html#search-experiments) | ||
* [Snowflake externa function translators](https://docs.snowflake.com/en/sql-reference/external-functions-translators) for | ||
changing the format of the data sent/received from the MLflow instance. | ||
* [Snowflake API integration](https://docs.snowflake.com/en/sql-reference/sql/create-api-integration) for setting up | ||
a communication channel from the Snowflake instance to the cloud HTTPS proxy/gateway service | ||
where your MLflow instance is hosted (e.g. Amazon API Gateway, Google Cloud API Gateway or Azure API Management). | ||
* [Snowflake storage integration](https://docs.snowflake.com/en/sql-reference/sql/create-storage-integration) to enable | ||
your Snowflake instance to upload artifacts (e.g. serialized models) to the cloud storage (Amazon S3, Azure Blob Storage, Google Cloud Storage) used by the | ||
MLflow instance. | ||
## Configuration example | ||
|
||
```yaml | ||
mlflow: | ||
# MLflow experiment name for tracking runs | ||
experiment_name: demo-mlops | ||
stage: "@MLFLOW_STAGE" | ||
# Snowflake external functions needed for calling MLflow instance | ||
functions: | ||
experiment_get_by_name: demo.demo.mlflow_experiment_get_by_name | ||
run_create: demo.demo.mlflow_run_create | ||
run_update: demo.demo.mlflow_run_update | ||
run_log_metric: demo.demo.mlflow_run_log_metric | ||
run_log_parameter: demo.demo.mlflow_run_log_parameter | ||
``` | ||
|
||
## Kedro starter | ||
The provided Kedro starter (Snowflights) has a builtin MLflow support. | ||
You can enable it during the project setup, i.e.: | ||
```bash | ||
Enable Mlflow Integration (See Documentation For The Configuration Instructions) | ||
================================================================================ | ||
|
||
[False]: True | ||
|
||
``` | ||
|
||
## Deployment to Snowflake and inference | ||
|
||
You can find instructions on how to make `mlflow-snowflake` integration here: https://github.com/Snowflake-Labs/mlflow-snowflake | ||
|
||
### Deployment | ||
|
||
### Inference with User Defined Function (UDF) | ||
```sql | ||
select | ||
MLFLOW$SNOWFLIGHTS_MODEL( | ||
"engines", | ||
"passenger_capacity", | ||
"crew", | ||
"d_check_complete", | ||
"moon_clearance_complete", | ||
"iata_approved", | ||
"company_rating", | ||
"review_scores_rating" | ||
) AS price | ||
from | ||
( | ||
select | ||
1 as "engines", | ||
100 as "passenger_capacity", | ||
5 as "crew", | ||
true as "d_check_complete", | ||
true as "moon_clearance_complete", | ||
true as "iata_approved", | ||
10.0 as "company_rating", | ||
5.0 as "review_scores_rating" | ||
union all | ||
select | ||
2, | ||
20, | ||
5, | ||
false, | ||
false, | ||
false, | ||
3.0, | ||
5.0 | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,3 +105,8 @@ kedroazureml | |
ly | ||
svg | ||
MLOps | ||
natively | ||
analytics | ||
Snowpark | ||
Snowflights | ||
Kedro's |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just add link to https://github.com/Snowflake-Labs/mlflow-snowflake ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added