pytorch / torchtitan

A native PyTorch Library for large model training
BSD 3-Clause "New" or "Revised" License
1.28k stars 115 forks source link

Use general way to access and update submodules #371

Closed kwen2501 closed 1 month ago

kwen2501 commented 1 month ago

Stack from ghstack (oldest at bottom):

This PR fixes the issue mentioned here: "Module object has no attributed items."

The reason is, a split ModuleDict is no longer a ModuleDict.

It would be more generally applicable if we use named_children() and register_module() to access and update submodules.