acoustic-carpenter-78188
02/16/2023, 11:44 PMAnnotated[StructuredDataset, kwtypes(...)] leads to this error:
return cast(LocallyExecutable, entity).local_execute(ctx, **kwargs)
File "/Users/nielsbantilan/miniconda3/envs/flyte-vscode-demo/lib/python3.9/site-packages/flytekit/core/base_task.py", line 264, in local_execute
outputs_literal_map = self.dispatch_execute(ctx, input_literal_map)
File "/Users/nielsbantilan/miniconda3/envs/flyte-vscode-demo/lib/python3.9/site-packages/flytekit/core/base_task.py", line 525, in dispatch_execute
raise TypeError(
TypeError: Failed to convert return value for var o0 for function prepare_train_args with error <class 'TypeError'>: unhashable type: 'collections.OrderedDict'
Expected behavior
This should work like un-annotated StructuredDataset
Additional context to reproduce
Example:
WineDataset = Annotated[
StructuredDataset,
kwtypes(
alcohol=float,
malic_acid=float,
ash=float,
alcalinity_of_ash=float,
magnesium=float,
total_phenols=float,
flavanoids=float,
nonflavanoid_phenols=float,
proanthocyanins=float,
color_intensity=float,
hue=float,
od280_od315_of_diluted_wines=float,
proline=float,
target=int,
)
]
@dataclass_json
@dataclass
class TrainArgs:
hyperparameters: dict
data: WineDataset
@task
def prepare_train_args(hp_grid: List[dict], data: WineDataset) -> List[TrainArgs]:
return [TrainArgs(hp, data) for hp in hp_grid]
Using this in a workflow will lead to the error above
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
02/16/2023, 11:44 PM