acoustic-carpenter-78188
11/12/2023, 3:43 AMimport pandas as pd
from sklearn.datasets import load_wine
from sklearn.linear_model import LogisticRegression
import flytekit.extras.sklearn
from flytekit import task, workflow
@task
def get_data() -> pd.DataFrame:
"""Get the wine dataset."""
return load_wine(as_frame=True).frame
@task
def process_data(data: pd.DataFrame) -> pd.DataFrame:
"""Simplify the task from a 3-class to a binary classification problem."""
return data.assign(target=lambda x: x["target"].where(x["target"] == 0, 1))
@task
def train_model(data: pd.DataFrame, hyperparameters: dict) -> LogisticRegression:
"""Train a model on the wine dataset."""
features = data.drop("target", axis="columns")
target = data["target"]
return LogisticRegression(max_iter=3000, **hyperparameters).fit(features, target)
@workflow
def training_workflow(hyperparameters: dict) -> LogisticRegression:
"""Put all of the steps together into a single workflow."""
data = get_data()
processed_data = process_data(data=data)
return train_model(
data=processed_data,
hyperparameters=hyperparameters,
)
Using command: pyflyte run example.py training_workflow --hyperparameters '{"C": 0.1}'
And i get the following bug:
image
I don't think it's necessarily related to M1, as I tried switching arch to x86_64 and rerunning it and I get the same error.
During the run, I think it tries to save the pandas dataframe, but fails. Here is the output of the script (empty folders, note the `file://`:
image
Expected behavior
Code should run to completion
Additional context to reproduce
No response
Screenshots
No response
Are you sure this issue hasn't been raised already?
☑︎ Yes
Have you read the Code of Conduct?
☑︎ Yes
flyteorg/flytefreezing-airport-6809
acoustic-carpenter-78188
12/08/2023, 12:26 PM