Closed nateraw closed 2 years ago
Should CardData
accept arbitrary unknown data? I think it should.
I think I agree @adrinjalali. In this case, should I stop using DataClasses and just make a class that accepts **kwargs?
In this case we'll also want to validate that everything here is serializable!
on the hub side arbitrary data is supported (and outputted as is)
In this case we'll also want to validate that everything here is serializable!
We could also just fail while serializing instead of checking to start with, and see how that goes, and then improve on our error handling/messages if necessary, WDYT?
When loading a card from the hub, this package fails when loading one that has unhandled fields in the metadata header. For example, widgets.
To recreate the issue,
pip install modelcards
, then:You'll get
TypeError: __init__() got an unexpected keyword argument 'co2_eq_emissions'
. This is coming fromCardData
's init, which doesn't expect thisco2_eq_emissions
key. This example specifically is related to #14, but it is also true for many other fields that are used in the metadata header ('widgets', etc.)