This would be nice to have.
Right now, when working with model cards, it's not so easy to get a good overview of what sections currently do or don't exist. The repr of the object gives some indication, but besides sections, it also displays the contents, which is distracting. It also truncates long strings, which can obscure the section names.
Having a nice overview of the section names, especially when it comes to nested subsections, would be really helpful. Especially when I want to add a subsection to an existing subsection, since I need to know the full name to the subsection, it requires some digging right now.
For now, I'm using something like this:
from skops.card._model_card import Section
def iterate_key_section_content(
data: dict[str, Section],
parent_section: str = "",
parent_keys: list[str] | None = None,
level: int = 0,
):
parent_keys = parent_keys or []
for key, val in data.items():
if not getattr(val, "visible", True):
continue
if parent_section:
title = "/".join((parent_section, val.title))
else:
title = val.title
yield title, level
if val.subsections:
yield from iterate_key_section_content(
val.subsections,
parent_section=title,
parent_keys=parent_keys + [key],
level=level + 1,
)
With that function, I can do something like this:
>>> for title, level in iterate_key_section_content(model_card._data):
... print(title)
Model description
Model description/Intended uses & limitations
Model description/Training Procedure
Model description/Training Procedure/Hyperparameters
Model description/Training Procedure/Model Plot
Model description/Evaluation Results
How to Get Started with the Model
Model Card Authors
Model Card Contact
Citation
This would be nice to have.
Right now, when working with model cards, it's not so easy to get a good overview of what sections currently do or don't exist. The
reprof the object gives some indication, but besides sections, it also displays the contents, which is distracting. It also truncates long strings, which can obscure the section names.Having a nice overview of the section names, especially when it comes to nested subsections, would be really helpful. Especially when I want to add a subsection to an existing subsection, since I need to know the full name to the subsection, it requires some digging right now.
For now, I'm using something like this:
With that function, I can do something like this: