You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a directory path is provided, the file is saved as `infos.yaml` inside that
69
80
directory.
70
81
71
-
## Mapping-style access
82
+
## Typed access and serialization
72
83
73
-
`Infos`provides read-only mapping-style helpers for compatibility with code
74
-
expecting a YAML-like dictionary:
84
+
`Infos`is a Pydantic model. Access metadata through typed attributes and use
85
+
Pydantic serialization when a plain mapping is needed:
75
86
76
87
```python
77
-
owner = infos["legal"]["owner"]
78
-
backend = infos.get("storage_backend")
79
-
payload = infos.to_dict()
88
+
owner = infos.owner
89
+
backend = infos.storage_backend
90
+
payload = infos.model_dump(exclude_none=True)
80
91
```
81
92
82
93
## Notes
83
94
84
-
-`legal.owner` and `legal.license` are required when validating complete infos.
85
-
-`num_samples` and `storage_backend` are automatically filled when `save_to_disk(..., infos=...)` is called before writing `infos.yaml`.
95
+
-`owner` and `license` are required when creating infos.
96
+
-`num_samples` and `storage_backend` are required when loading persisted dataset infos.
97
+
-`num_samples` and `storage_backend` are overwritten with the actual saved dataset values when `save_to_disk(..., infos=...)` is called before writing `infos.yaml`.
86
98
- Unknown keys are rejected during validation.
87
99
-`save_to_file(...)` writes YAML using the standard infos key order.
0 commit comments