helpful-van-10149
01/21/2025, 3:48 PMdef create_plan() -> Plan:
report_plan = ReportPlans.simple(
model_plan,
*charts,
report_type=report_type,
)
return report_plan
# ReportPlans.simple will return SimpleReportPlan.
Plan = Union[ReportPlan, ReleasePlan]
ReportPlan = Union[SimpleReportPlan, UserDefinedReportPlan]
ReleasePlan = Union[
SimpleModelReleasePlan,
GetModelShaReleasePlan,
MapReleasePlan,
SelectModelThresholdsReleasePlan,
SetThresholdsReleasePlan,
AttachFeatureGeneratorsReleasePlan,
ModelDeployReleasePlan,
ActivateReleaseGatesReleasePlan,
]
However, when I tried to run this task, it will return:
Traceback (most recent call last):
File "/app/src/python/flyte/ml_exploration/mlp_example/py_mlp_example.binary.runfiles/py_deps_ml_golden_202407_00_00_py311/flytekit/flytekit/flytekit/core/base_task.py", line 800, in dispatch_execute
literals_map, native_outputs_as_map = run_sync(
^^^^^^^^^
File "/app/src/python/flyte/ml_exploration/mlp_example/py_mlp_example.binary.runfiles/py_deps_ml_golden_202407_00_00_py311/flytekit/flytekit/flytekit/utils/asyn.py", line 93, in run_sync
return self._runner_map[name].run(coro)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/src/python/flyte/ml_exploration/mlp_example/py_mlp_example.binary.runfiles/py_deps_ml_golden_202407_00_00_py311/flytekit/flytekit/flytekit/utils/asyn.py", line 72, in run
res = fut.result(None)
^^^^^^^^^^^^^^^^
File "/app/src/python/flyte/ml_exploration/mlp_example/py_mlp_example.binary.runfiles/python_interpreter_3_11/lib/python3.11/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/app/src/python/flyte/ml_exploration/mlp_example/py_mlp_example.binary.runfiles/python_interpreter_3_11/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/app/src/python/flyte/ml_exploration/mlp_example/py_mlp_example.binary.runfiles/py_deps_ml_golden_202407_00_00_py311/flytekit/flytekit/flytekit/core/base_task.py", line 655, in _output_to_literal_map
raise e
File "/app/src/python/flyte/ml_exploration/mlp_example/py_mlp_example.binary.runfiles/py_deps_ml_golden_202407_00_00_py311/flytekit/flytekit/flytekit/core/type_engine.py", line 1425, in async_to_literal
lv = await transformer.async_to_literal(ctx, python_val, python_type, expected)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/src/python/flyte/ml_exploration/mlp_example/py_mlp_example.binary.runfiles/py_deps_ml_golden_202407_00_00_py311/flytekit/flytekit/flytekit/core/type_engine.py", line 1934, in async_to_literal
raise TypeTransformerFailedError(f"Cannot convert from {python_val} to {python_type}")
flytekit.core.type_engine.TypeTransformerFailedError: Failed to convert outputs of task 'src.python.flyte.ml_exploration.mlp_example.main.create_plan' at position 0.
Failed to convert type <class 'src.python.flyte.ml_pipeline.config.SimpleReportPlan'> to type typing.Union[src.python.flyte.ml_pipeline.config.SimpleReportPlan, src.python.flyte.ml_pipeline.config.UserDefinedReportPlan, src.python.flyte.ml_pipeline.config.SimpleModelReleasePlan, src.python.flyte.ml_pipeline.config.GetModelShaReleasePlan, src.python.flyte.ml_pipeline.config.MapReleasePlan, src.python.flyte.ml_pipeline.config.SelectModelThresholdsReleasePlan, src.python.flyte.ml_pipeline.config.SetThresholdsReleasePlan, src.python.flyte.ml_pipeline.config.AttachFeatureGeneratorsReleasePlan, src.python.flyte.ml_pipeline.config.ModelDeployReleasePlan, src.python.flyte.ml_pipeline.config.ActivateReleaseGatesReleasePlan].
Could someone point me the direction for troubleshooting?damp-lion-88352
01/21/2025, 4:10 PMhelpful-van-10149
01/21/2025, 4:13 PMdamp-lion-88352
01/21/2025, 4:33 PMhelpful-van-10149
01/21/2025, 4:36 PMdamp-lion-88352
01/21/2025, 4:37 PMdamp-lion-88352
01/21/2025, 4:37 PMdamp-lion-88352
01/21/2025, 4:38 PMdamp-lion-88352
01/21/2025, 4:38 PMhelpful-van-10149
01/21/2025, 4:39 PMdamp-lion-88352
01/21/2025, 4:42 PMdamp-lion-88352
01/21/2025, 4:42 PMdamp-lion-88352
01/21/2025, 4:42 PMhelpful-van-10149
01/21/2025, 4:42 PMcan you run pyflyte run -vv xxx.py xxx?I believe I can!
helpful-van-10149
01/21/2025, 4:43 PMdamp-lion-88352
01/21/2025, 4:44 PMdamp-lion-88352
01/21/2025, 4:45 PMpyflyte run xxx.py t1
helpful-van-10149
01/21/2025, 4:57 PMhelpful-van-10149
01/21/2025, 5:16 PMhelpful-van-10149
01/21/2025, 5:17 PMhelpful-van-10149
01/21/2025, 6:07 PMhelpful-van-10149
01/21/2025, 6:07 PMhigh-accountant-32689
01/21/2025, 7:41 PMTypeTransformerError
.
Since you have a local repro, can you bump the verbosity of the flytekit logs, try again and reason from the exception why the Dataclass transformer is failing in all cases?helpful-van-10149
01/21/2025, 7:44 PMbump the verbosity of the flytekit logsMay I know how can I do this?
helpful-van-10149
01/21/2025, 7:55 PM19:53:52.172255 ERROR type_engine.py:616 - Failed to extract schema for
object <class
'src.python.flyte.ml_pipeline.config.SimpleReportPlan'>
, error: Type
src.python.flyte.ml_pipeline.config.CreateModelProtocol
of field "create_model_fn" in
src.python.flyte.ml_pipeline.config.CreateBuiltInModelP
lan isn't supported
Please remove `DataClassJsonMixin` and `dataclass_json`
decorator from the dataclass definition
19:53:52.192758 WARNING type_engine.py:639 - Failed to extract schema for
object <class
'src.python.flyte.ml_pipeline.config.SimpleReportPlan'>
, (will run schemaless) error: Field.__init__() takes 1
positional argument but 2 were givenIf you have
postponed annotations turned on (PEP 563) turn it off
please. Postponedevaluation doesn't work with json
dataclasses
19:53:52.210011 ERROR type_engine.py:616 - Failed to extract schema for
object <class
'src.python.flyte.ml_pipeline.config.UserDefinedReportP
lan'>, error: Type
src.python.flyte.ml_pipeline.config.ReportProtocol of
field "report_fn" in
src.python.flyte.ml_pipeline.config.UserDefinedReportPl
an isn't supported
Please remove `DataClassJsonMixin` and `dataclass_json`
decorator from the dataclass definition
19:53:52.227690 WARNING type_engine.py:639 - Failed to extract schema for
object <class
'src.python.flyte.ml_pipeline.config.UserDefinedReportP
lan'>, (will run schemaless) error: Field.__init__()
takes 1 positional argument but 2 were givenIf you have
postponed annotations turned on (PEP 563) turn it off
please. Postponedevaluation doesn't work with json
dataclasses
helpful-van-10149
01/21/2025, 8:00 PMexport FLYTE_SDK_LOGGING_LEVEL=10
?high-accountant-32689
01/21/2025, 8:01 PMthankful-minister-83577
helpful-van-10149
01/21/2025, 8:01 PMFLYTE_SDK_DEV_LOGGING_LEVEL
Is this one?helpful-van-10149
01/21/2025, 8:03 PMhelpful-van-10149
01/21/2025, 8:03 PMhelpful-van-10149
01/21/2025, 10:16 PM@dataclass
class A:
a: int
@dataclass
class B:
a: int
YOUNG = Union[A, B]
@task
def foo(inp: int) -> YOUNG:
return B(a=inp)
@task
def foo2(inp: YOUNG) -> int:
return inp.a
@workflow
def wf():
inp_return = foo(inp=1)
foo2(inp=inp_return)
But the error seems fall into Ambiguous:
Message:
TypeError: Failed to convert outputs of task 'src.python.flyte.ml_exploration.airail.sweeps_example.main.foo' at position 0.
Failed to convert type <class 'src.python.flyte.ml_exploration.airail.sweeps_example.main.B'> to type typing.Union[src.python.flyte.ml_exploration.airail.sweeps_example.main.A, src.python.flyte.ml_exploration.airail.sweeps_example.main.B].
Error Message: Ambiguous choice of variant for union type.
damp-lion-88352
01/22/2025, 12:46 AMdamp-lion-88352
01/22/2025, 12:51 AMhelpful-van-10149
01/22/2025, 12:51 AMdamp-lion-88352
01/22/2025, 12:52 AM@dataclass
class B:
a: int
to
@dataclass
class B:
b: int
damp-lion-88352
01/22/2025, 12:52 AMdamp-lion-88352
01/22/2025, 12:52 AM@dataclass
class A:
a: int
@dataclass
class B:
a: int
to
@dataclass
class A:
a: int
@dataclass
class B:
b: int
thankful-minister-83577
A
and one is named B
is irrelevant - the schemas are identical)thankful-minister-83577
damp-lion-88352
01/22/2025, 12:56 AMdamp-lion-88352
01/22/2025, 12:56 AMthankful-minister-83577
TypeError: Ambiguous choice of variant for union type. Both Object-Dataclass-Transformer and Object-Dataclass-Transformer transformers match
thankful-minister-83577
helpful-van-10149
01/22/2025, 3:37 AMdamp-lion-88352
01/22/2025, 3:44 AMUnion
, and see if we can transform python val to literaldamp-lion-88352
01/22/2025, 3:44 AMdamp-lion-88352
01/22/2025, 3:44 AMdamp-lion-88352
01/22/2025, 3:44 AMdamp-lion-88352
01/22/2025, 3:44 AMdamp-lion-88352
01/22/2025, 3:45 AMdamp-lion-88352
01/22/2025, 4:03 AMdamp-lion-88352
01/22/2025, 4:03 AMdamp-lion-88352
01/22/2025, 4:04 AMhigh-accountant-32689
01/22/2025, 2:47 PMField.___init___
make sense?). I'm especially interested in these exceptions and since you have a local repro, if you set FLYTE_SDK_LOGGING_LEVEL=30
you should be able to see those without a lot of clutter.
Also, can you confirm the versions of the dependencies you're running in each case? Specifically, what are the versions of dataclasses-json
, mashumaro
, and marshmallow
when you run this in flytekit 1.11.0 and 1.14.0?damp-lion-88352
01/22/2025, 2:52 PMhelpful-van-10149
01/22/2025, 3:41 PMhelpful-van-10149
01/22/2025, 3:51 PMwhat are the versions ofFor flytekit v1.14.0:,dataclasses-json
, andmashumaro
when you run this in flytekit 1.11.0 and 1.14.0?marshmallow
dataclasses-json
: 0.5.7
mashumaro
: 3.13
marshmallow
: 3.21.3
For flytekit v1.11.0:
dataclasses-json
: 0.5.7
mashumaro
: 3.13
marshmallow
: 3.21.3damp-lion-88352
01/22/2025, 3:52 PMFLYTE_USE_OLD_DC_FORMAT=true pyflyte run xxx
damp-lion-88352
01/22/2025, 3:52 PMhelpful-van-10149
01/22/2025, 3:53 PMUnionTransformer failed attempt to convert from {python_val} to {t} error: {e}
helpful-van-10149
01/22/2025, 3:55 PMdamp-lion-88352
01/22/2025, 3:55 PMdamp-lion-88352
01/22/2025, 3:55 PMdamp-lion-88352
01/22/2025, 3:55 PMhelpful-van-10149
01/22/2025, 4:42 PMdamp-lion-88352
01/22/2025, 4:49 PMdamp-lion-88352
01/22/2025, 4:49 PMhelpful-van-10149
01/22/2025, 4:51 PMhelpful-van-10149
01/22/2025, 6:29 PMhigh-accountant-32689
01/22/2025, 7:54 PMhelpful-van-10149
01/22/2025, 7:57 PMhelpful-van-10149
01/22/2025, 7:58 PMhelpful-van-10149
01/22/2025, 9:57 PMunion_type {
variants {
simple: STRUCT
annotation {
annotations {
fields {
key: "cache-key-metadata"
value {
struct_value {
fields {
key: "serialization-format"
value {
string_value: "msgpack"
}
}
}
}
}
}
}
structure {
tag: "SimpleReportPlanTransformer"
}
}
variants {
simple: STRUCT
annotation {
annotations {
fields {
key: "cache-key-metadata"
value {
struct_value {
fields {
key: "serialization-format"
value {
string_value: "msgpack"
}
}
}
}
}
}
}
structure {
tag: "UserDefinedReportPlanTransformer"
}
}
in v1.11.0
union_type {
variants {
simple: STRUCT
structure {
tag: "SimpleReportPlanTransformer"
}
}
variants {
simple: STRUCT
structure {
tag: "UserDefinedReportPlanTransformer"
}
}
damp-lion-88352
01/23/2025, 2:43 AMdamp-lion-88352
01/23/2025, 2:43 AMhelpful-van-10149
01/23/2025, 3:08 AMhelpful-van-10149
01/23/2025, 3:40 AMhelpful-van-10149
01/23/2025, 3:40 AMhelpful-van-10149
01/23/2025, 3:40 AMpyflyte run example.py report_workflow
helpful-van-10149
01/23/2025, 3:55 AMRegisterPolymorphicDataclasses._register_flyte_transfomers(union_type, name)
the workflow will work.. Let me dive deep on this.helpful-van-10149
01/23/2025, 4:09 AMhigh-accountant-32689
01/23/2025, 3:32 PMhelpful-van-10149
01/23/2025, 3:33 PMhelpful-van-10149
01/23/2025, 3:35 PMhigh-accountant-32689
01/23/2025, 3:44 PMhigh-accountant-32689
01/23/2025, 3:45 PMhigh-accountant-32689
01/23/2025, 3:53 PMhelpful-van-10149
01/23/2025, 3:53 PMhelpful-van-10149
01/23/2025, 4:02 PMhelpful-van-10149
01/23/2025, 5:10 PM[flytekit] UnionTransformer failed attempt to convert from SimpleReportPlan(model_plan=TrainTrainableModelsPlan(upstream=ExperimentModelPlan(upstream=CreateBuiltInModelPlan(create_model_fn=FunctionReference(local_reference='src.python.flyte.ml_exploration.mlp_example.main/create_model/M1PRv3kOk3U4XiMjtCwB1Q9R/jy7dFZaWv+LRjkcxLY=', remote_reference=RemoteReference(project='ml-exploration', domain='adhoc', name='src.python.flyte.ml_exploration.mlp_example.main.create_model', version='upgrade-flytekit-14-7ce2dd26d4e3-zoz7')), model_details=BuiltInModelTypeDetails(model_type=<ModelType.XGBOOST: 'xgboost'>, serialized_kwargs='{"boolean_features":["server_ipmaxmind__is_anonymous"],"categorical_features":["card_bin__bin"],"label":"has_fraud_dispute","numerical_features":["stripe_jstime_on_page","amount_in_usd"]}', _type='built_in_model_type_details'), dataset_plans=DatasetPlanSet(plans={'train': SimpleDatasetPlan(path='<s3://stripe-data/ml-platform/examples/txn-fraud-train/>', is_day_partitioned=False, bounds=TemporalBounds(start_date='2019-11-06', end_date='2019-12-16', _type='temporal'), timestamp_column_for_bounds='created', _type='simple_dataset_plan'), 'eval': SimpleDatasetPlan(path='<s3://stripe-data/ml-platform/examples/txn-fraud-train/>', is_day_partitioned=False, bounds=TemporalBounds(start_date='2019-12-16', end_date='2019-12-21', _type='temporal'), timestamp_column_for_bounds='created', _type='simple_dataset_plan'), 'test': SimpleDatasetPlan(path='<s3://stripe-data/ml-platform/examples/txn-fraud-train/>', is_day_partitioned=False, bounds=TemporalBounds(start_date='2019-12-21', end_date='2019-12-31', _type='temporal'), timestamp_column_for_bounds='created', _type='simple_dataset_plan')}), serialized_kwargs='{"boolean_features":["server_ipmaxmind__is_anonymous"],"categorical_features":["card_bin__bin"],"label":"has_fraud_dispute","numerical_features":["stripe_jstime_on_page","amount_in_usd"]}', _type='create_built_in_model_plan'), experiments=[('baseline', CreateBuiltInModelPlan(create_model_fn=FunctionReference(local_reference='src.python.flyte.ml_exploration.mlp_example.main/create_model/M1PRv3kOk3U4XiMjtCwB1Q9R/jy7dFZaWv+LRjkcxLY=', remote_reference=RemoteReference(project='ml-exploration', domain='adhoc', name='src.python.flyte.ml_exploration.mlp_example.main.create_model', version='upgrade-flytekit-14-7ce2dd26d4e3-zoz7')), model_details=BuiltInModelTypeDetails(model_type=<ModelType.XGBOOST: 'xgboost'>, serialized_kwargs='{"boolean_features":["server_ipmaxmind__is_anonymous"],"categorical_features":["card_bin__bin"],"label":"has_fraud_dispute","numerical_features":["stripe_jstime_on_page","amount_in_usd"]}', _type='built_in_model_type_details'), dataset_plans=DatasetPlanSet(plans={'train': SimpleDatasetPlan(path='<s3://stripe-data/ml-platform/examples/txn-fraud-train/>', is_day_partitioned=False, bounds=TemporalBounds(start_date='2019-11-06', end_date='2019-12-16', _type='temporal'), timestamp_column_for_bounds='created', _type='simple_dataset_plan'), 'eval': SimpleDatasetPlan(path='<s3://stripe-data/ml-platform/examples/txn-fraud-train/>', is_day_partitioned=False, bounds=TemporalBounds(start_date='2019-12-16', end_date='2019-12-21', _type='temporal'), timestamp_column_for_bounds='created', _type='simple_dataset_plan'), 'test': SimpleDatasetPlan(path='<s3://stripe-data/ml-platform/examples/txn-fraud-train/>', is_day_partitioned=False, bounds=TemporalBounds(start_date='2019-12-21', end_date='2019-12-31', _type='temporal'), timestamp_column_for_bounds='created', _type='simple_dataset_plan')}), serialized_kwargs='{"boolean_features":["server_ipmaxmind__is_anonymous"],"categorical_features":["card_bin__bin"],"label":"has_fraud_dispute","numerical_features":["stripe_jstime_on_page","amount_in_usd"]}', _type='create_built_in_model_plan'))], _type='experiment_model_plan'), n=1, random_seed_path=None, resources=TaskResources(mem='200Gi', cpu='30', gpu=None, ephemeral_storage='200Gi'), store_configs_path=None, _type='train_trainable_models_plan'), charts=[MultiComparisonChart(title='Multi Comparison Chart: AUROC', segment=Segment(dataset_plan_name='test', _type='segment'), eval_config=EvalConfig(unique_id_col='charge_id', label_col='has_fraud_dispute'), metric=ROCBasedMetric(fpr_start=0.0, fpr_end=1.0, num_buckets=1000, num_bootstraps=50), gating_config=None, raise_if_baseline_missing=False, grouping_columns=[], selector=None, explanation=None, weight_col=None, created_col='created', time_grouper=None, scores_col='score', output_curves=False, _type='multi_comparison_chart')], report_type=<ReportingType.WANDB: 'wandb'>, snapshot_date='', slack_message=None, _type='simple_report_plan') to <class 'src.python.flyte.ml_pipeline.config.SimpleReportPlan'> error: Field "create_model_fn" of type CreateModelProtocol in CreateBuiltInModelPlan is not serializable
helpful-van-10149
01/23/2025, 5:11 PMerror: Field "create_model_fn" of type CreateModelProtocol in CreateBuiltInModelPlan is not serializable
echoing-kilobyte-84070
03/19/2025, 9:26 PMechoing-kilobyte-84070
03/19/2025, 9:27 PMline 32
):
Failed to convert type <class 'src.python.flyte.ml_pipeline.config.SimpleReportPlan'> to type typing.Union[src.python.flyte.ml_pipeline.config.SimpleReportPlan, src.python.flyte.ml_pipeline.config.UserDefinedReportPlan, src.python.flyte.ml_pipeline.config.SimpleModelReleasePlan, src.python.flyte.ml_pipeline.config.GetModelShaReleasePlan, src.python.flyte.ml_pipeline.config.MapReleasePlan, src.python.flyte.ml_pipeline.config.SelectModelThresholdsReleasePlan, src.python.flyte.ml_pipeline.config.SetThresholdsReleasePlan, src.python.flyte.ml_pipeline.config.AttachFeatureGeneratorsReleasePlan, src.python.flyte.ml_pipeline.config.ModelDeployReleasePlan, src.python.flyte.ml_pipeline.config.ActivateReleaseGatesReleasePlan].
echoing-kilobyte-84070
03/19/2025, 9:27 PMcrooked-lifeguard-46802
04/04/2025, 9:05 PMfreezing-airport-6809
freezing-airport-6809
freezing-airport-6809