https://flyte.org logo
#ask-the-community
Title
# ask-the-community
f

Frank Shen

11/29/2022, 8:46 PM
I think it because of these None values:
Copy code
'timesteps_total': None,
 'episodes_total': None,
j

Jay Ganbat

11/29/2022, 8:51 PM
ohh yeah, Flyte does not like Nones, we have been converting it to empty strings 😅 maybe nested None doesnt work, but it should support Optional or None starting from 1.1 i think
k

Kevin Su

11/29/2022, 9:19 PM
yes, could you try Dict[str, Optional[Any]]
f

Frank Shen

11/29/2022, 10:10 PM
@Kevin Su, I tried and got:
Copy code
File "/Users/fshen/hbo-code/dai-mle-models/env/lib/python3.8/site-packages/flytekit/core/type_engine.py", line 1060, in to_literal
    raise TypeError("Ambiguous choice of variant for union type")
y

Yee

11/29/2022, 10:19 PM
this is also a bit like a grab bag of entries. would it be possible for you to convert it into a dataclass?
g

Greg Gydush

11/29/2022, 10:26 PM
an untyped
dict
should do the trick here too
f

Frank Shen

11/29/2022, 10:28 PM
@Greg Gydush, how do you define a untyped dict in a return type? Like this?
Copy code
-> typing.Dict
g

Greg Gydush

11/29/2022, 10:29 PM
yes
f

Frank Shen

11/29/2022, 10:35 PM
@Greg Gydush, it works! Thank you very much!
@Yee, it could work. However, I don’t want the added efforts of defining the dataclass and the maintenance afterwards.
y

Yee

11/29/2022, 10:37 PM
yup got it.
thanks @Greg Gydush!
g

Greg Gydush

11/29/2022, 10:38 PM
of course, the DictTransformer is very versatile - I ran into the same issue before, but found this fix!