Jernej Frank
07/15/2024, 2:35 PMto.mlflow()
materializer since our models are not in their named flavors?Thierry Jean
07/15/2024, 3:07 PMJernej Frank
07/15/2024, 3:56 PMcustom_flavor.py
that implemented save_model,log_model,load_model,_CustomModelWrapper
. Then I just import it and use it in the MLflow context manager:
import mlflow
import custom_flavor
with mlflow.start_run():
custom_flavor.log_model(
custom_model=test_model,
artifact_path=ARTIFACT_PATH,
)
Looking at your mlflow_extension.py, seems to me that this part of the code trips me up: https://github.com/DAGWorks-Inc/hamilton/blob/main/hamilton/plugins/mlflow_extensions.py#L50C8-L54C75Jernej Frank
07/15/2024, 3:58 PMexperiment_id
and run_id
, but would be cool to be able to use the materializer 🙂Thierry Jean
07/15/2024, 6:37 PMto.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)
# Solution
The most straight solution is to allow flavor
to receive the Python module defining the custom flavor.
import custom_flavor
to.mlflow(..., flavor=custom_flavor)
# consequently, this would also work
import mlflow
to.mlflow(..., flavor=mlflow.sklearn)
I will produce a release candidate of Hamilton that you'll be able to install and try to make sure everything is smooth before we add it to the official release 😁 Will ping you when it's availableThierry Jean
07/15/2024, 6:38 PMfrom_.mlflow(..., flavor=custom_flavor)
If you could try it out, it would be helpful 🙂Jernej Frank
07/15/2024, 7:20 PMThierry Jean
07/15/2024, 8:06 PMpip install --upgrade sf-hamilton==1.71.0rc1
Jernej Frank
07/26/2024, 8:53 PMJernej Frank
07/26/2024, 8:54 PMStefan Krawczyk
07/27/2024, 3:57 AMStefan Krawczyk
07/27/2024, 4:07 AMJernej Frank
07/29/2024, 7:41 AMStefan Krawczyk
07/29/2024, 2:47 PM