<#3319 [BUG] OneHotEncoder type not supported as t...
# flytekit
a
#3319 [BUG] OneHotEncoder type not supported as task input when None is supplied as input value. Issue created by xshen8888 Describe the bug The task’s input is of type sklearn.preprocessing.OneHotEncoder. It is either supplied by the caller or None if user doesn’t have a encoder instance as input (in which case the task code will get it from an offline storage location). I tried both, with or without Optional.
Copy code
@task
def transform(encoder: Optional[OneHotEncoder] = None, ...)
def transform(encoder: OneHotEncoder = None, ...)
When caller do transform(encoder=None, ...), the task will work successfully with pyflyte run (locally).
However, if I bake the module containing the task estimate() into an image and refer to it in a pyflyte remote run, no mater what I do, I keep getting at the terminal (before pyflyte submit the code to remote flyte server):
flytekit/core/type_engine.py", line 1060, in to_literal
    raise TypeError("Ambiguous choice of variant for union type")
...
flytekit/core/promise.py", line 937, in create_and_link_node
    raise AssertionError(f"Failed to Bind variable {k} for function {entity.name}.") from e
AssertionError: Failed to Bind variable **_encoder_** for function dai_mle_models.onehotenc.simple_onehotenc. transform.
Expected behavior The task should run remotely just like when None is supplied to pandas.DataFrame as task input value (which I have verified working). e.g.
Copy code
@task
def sometask(test_data: pd.DataFrame = None, ...)
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/flyte