Turn dotted keys into a nested dictionary
A model's weights come as a flat mapping from dotted names such as layer1.attention.query.weight to values. Convert it into a nested dictionary ({"layer1": {"attention": {"query": {"weight": ...}}}}). Handle numeric segments (list indices or keys), conflicts where a name is both a leaf and a prefix, and write the reverse conversion too.
No answer yet. Write the first one; the best answer gets endorsed.
