acoustic-carpenter-78188
11/30/2023, 8:38 PMpyflyte run example.py training_workflow --hyperparameters '{"C": 0.1}'
FlyteScopedUserException: 'target'
Failed with Unknown Exception <class 'KeyError'> Reason: 'Encountered error while executing workflow \'example.training_workflow\':\n "Error encountered while executing \'training_workflow\':\\n \'target\'"'
'Encountered error while executing workflow \'example.training_workflow\':\n "Error encountered while executing \'training_workflow\':\\n \'target\'"'
I also applied the fsspec
hotfix as described in #4414:
pip install fsspec<2023.10.0
Expected behavior
I expected the getting started example to run without errors when running the command:
pyflyte run example.py training_workflow --hyperparameters '{"C": 0.1}'
Additional context to reproduce
Code from getting started for reference
import 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 pd.DataFrame()
@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,
)
Screenshots
No response
Are you sure this issue hasn't been raised already?
☑︎ Yes
Have you read the Code of Conduct?
☑︎ Yes
flyteorg/flyteacoustic-carpenter-78188
11/30/2023, 8:38 PM