Skip to content
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

Plugin/mlflow custom flavor - fixed small bug #1068

Conversation

jernejfrank
Copy link
Contributor

Thanks for adding the custom flavor option to mlflow. I tested it and only the flavor specific kwargs somehow got mixed up and tried to be called somewhere else which lead to a fatal error.

Changes

  • renamed class attribute to avoid conflicting calls

How I tested this

  • added unit test that doubles as minimal example for reproducing the error

Notes

  • only tested the DataSaver (due to internal legacy structure, DataLoader is not utilised/hard to implement)

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

@skrawcz
Copy link
Collaborator

skrawcz commented Jul 26, 2024

Thanks @jernejfrank ! For the pre-commit failure you just need to do something like:

pip install pre-commit
pre-commit install
pre-commit run --all-files
And then check that change in and you should be good to go. Thanks for the fix!

@skrawcz
Copy link
Collaborator

skrawcz commented Jul 26, 2024

I'll plan to push this in the release on Monday. If you don't get to the pre-commit before I'll do it. Thanks!

@skrawcz skrawcz self-requested a review July 26, 2024 21:33
Copy link
Collaborator

@skrawcz skrawcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. just a few things:

  1. pre-commit.
  2. you added some files in by accident I assume from the hamilton_ui example.

examples/hamilton_ui/data_set_v1.parquet Outdated Show resolved Hide resolved
examples/hamilton_ui/lr_model.pkl Outdated Show resolved Hide resolved
examples/hamilton_ui/svm_model.pkl Outdated Show resolved Hide resolved
@skrawcz
Copy link
Collaborator

skrawcz commented Jul 27, 2024

Thanks @jernejfrank !

@skrawcz skrawcz merged commit ff40dd4 into DAGWorks-Inc:plugin/mlflow-custom-flavor Jul 27, 2024
24 checks passed
skrawcz pushed a commit that referenced this pull request Jul 27, 2024
Thanks for adding the custom flavor option to mlflow. I tested it and only the flavor specific kwargs somehow got mixed up and tried to be called somewhere else which lead to a fatal error.

Changes
renamed class attribute to avoid conflicting calls

How I tested this
added unit test that doubles as minimal example for reproducing the error

Notes
only tested the DataSaver (due to internal legacy structure, DataLoader is not utilised/hard to implement)

* working mlflow plugin need to add kwargs for custom flavor

* flavor kwargs used outside of mlflow saver/loader class

* updated class description

* flavor kwargs used outside of mlflow saver/loader class

* removed incidental files

---------

Co-authored-by: Jernej Frank <jernej.frank@oxehealth.com>
skrawcz added a commit that referenced this pull request Jul 29, 2024
Before, the MLFlow plugin would allow for 2 main patterns.
```python
to.mlflow(...)  # infer the flavor

to.mlflow(..., flavor="sklearn")  # mlflow supported flavor 
```
^Note that this should support the pyfunc flavor, which is a convenient way to create custom estimators (MLFlow reference)

Now, we can also pass in modules for mlflow flavors:

```python
import custom_flavor
to.mlflow(..., flavor=custom_flavor)
```
consequently, this would also work
```
import mlflow
to.mlflow(..., flavor=mlflow.sklearn)
```


Squashed commits:
* saver and loader now accept ModuleType for flavor kwarg

* Plugin/mlflow custom flavor - fixed small bug (#1068)

Thanks for adding the custom flavor option to mlflow. I tested it and only the flavor specific kwargs somehow got mixed up and tried to be called somewhere else which lead to a fatal error.

Changes
renamed class attribute to avoid conflicting calls

How I tested this
added unit test that doubles as minimal example for reproducing the error

Notes
only tested the DataSaver (due to internal legacy structure, DataLoader is not utilised/hard to implement)

* working mlflow plugin need to add kwargs for custom flavor

* flavor kwargs used outside of mlflow saver/loader class

* updated class description

* flavor kwargs used outside of mlflow saver/loader class

* removed incidental files

---------

Co-authored-by: Jernej Frank <jernej.frank@oxehealth.com>

* Adds ML loader test for kwargs

To complement saver.

---------

Co-authored-by: zilto <tjean@DESKTOP-V6JDCS2>
Co-authored-by: jernejfrank <50105951+jernejfrank@users.noreply.github.com>
Co-authored-by: Jernej Frank <jernej.frank@oxehealth.com>
@jernejfrank jernejfrank deleted the plugin/mlflow-custom-flavor branch August 1, 2024 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants