def freeze_structure(obj):
    """Freeze a structure and make it hashable."""
    if isinstance(obj, dict):
        return frozenset((k, freeze_structure(v)) for k, v in obj.items())
    elif isinstance(obj, (list, tuple)):
        return tuple(freeze_structure(item) for item in obj)
    elif isinstance(obj, set):
        return frozenset(obj)
    else:
        return obj
Freeze a structure and make it hashable.
vlmeval/dataset/utils/megabench/scoring/common/conversions.py