View source on GitHub |
Fields used to generate the Model Card.
Inherits From: BaseModelCardField
model_card_toolkit.ModelCard(
model_details: model_card_toolkit.ModelDetails
= dataclasses.field(default_factory=ModelDetails),
model_parameters: model_card_toolkit.ModelParameters
= dataclasses.field(default_factory=ModelParameters),
quantitative_analysis: model_card_toolkit.QuantitativeAnalysis
= dataclasses.field(default_factory=QuantitativeAnalysis),
considerations: model_card_toolkit.Considerations
= dataclasses.field(default_factory=Considerations),
_proto_type: dataclasses.InitVar[type(model_card_pb2.ModelCard)] = model_card_pb2.ModelCard
)
Methods
clear
clear()
Clear the subfields of this BaseModelCardField.
copy_from_proto
copy_from_proto(
proto: message.Message
) -> 'BaseModelCardField'
Copies the contents of the model card proto into current object.
from_json
from_json(
json_dict: Dict[str, Any]
) -> None
Reads ModelCard from JSON.
This function will overwrite all existing ModelCard fields.
Args | |
---|---|
json_dict
|
A JSON dict from which to populate fields in the model card schema. |
Raises | |
---|---|
JSONDecodeError
|
If json_dict is not a valid JSON string.
|
ValidationError
|
If json_dict does not follow the model card JSON
schema.
|
ValueError
|
If json_dict contains a value not in the class or schema
definition.
|
merge_from_json
merge_from_json(
json: Union[Dict[str, Any], str]
) -> None
Reads ModelCard from JSON.
This function will only overwrite ModelCard fields specified in the JSON.
Args | |
---|---|
json
|
A JSON object from whichto populate fields in the model card. This can be provided as either a dictionary or a string. |
Raises | |
---|---|
JSONDecodeError
|
If json_dict is not a valid JSON string.
|
ValidationError
|
If json_dict does not follow the model card JSON
schema.
|
ValueError
|
If json_dict contains a value not in the class or schema
definition.
|
merge_from_proto
merge_from_proto(
proto: message.Message
) -> 'BaseModelCardField'
Merges the contents of the model card proto into current object.
to_dict
to_dict() -> Dict[str, Any]
Convert your model card to a python dictionary.
to_json
to_json() -> str
Write ModelCard to JSON.
to_proto
to_proto() -> message.Message
Convert this class object to the proto.
__eq__
__eq__(
other
)
__len__
__len__() -> int
Returns the number of items in a field. Ignores None values recursively, so the length of a field that only contains another field that has all None values would be 0.