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

[BUG] Annotated StructuredDataset with kwtypes leads raises TypeError #3011

Closed
2 tasks done
cosmicBboy opened this issue Oct 21, 2022 · 0 comments · Fixed by flyteorg/flytekit#1508
Closed
2 tasks done
Assignees
Labels
bug Something isn't working
Milestone

Comments

@cosmicBboy
Copy link
Contributor

Describe the bug

Using an Annotated[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
@cosmicBboy cosmicBboy added bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers labels Oct 21, 2022
@eapolinario eapolinario removed the untriaged This issues has not yet been looked at by the Maintainers label Nov 4, 2022
@eapolinario eapolinario added this to the 1.3.0 milestone Nov 4, 2022
@cosmicBboy cosmicBboy modified the milestones: 1.3.0, 2023 Q1 Backlog, 1.4.0 Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants