INNER CODE UNIT · Python
load_annotations
allenai/objaverse-xl · objaverse/__init__.py:20
def load_annotations(uids: Optional[List[str]] = None) -> Dict[str, Any]:
"""Load the full metadata of all objects in the dataset.
Args:
uids: A list of uids with which to load metadata. If None, it loads
the metadata for all uids.
Returns:
A dictionary mapping the uid to the metadata.
"""
metadata_path = os.path.join(_VERSIONED_PATH, "metadata")
object_paths = _load_object_paths()
dir_ids = (
set(object_paths[uid].split("/")[1] for uid in uids)
if uids is not None
else [f"{i // 1000:03d}-{i % 1000:03d}" for i in range(160)]
)
if len(dir_ids) > 10: