torchrec
torchrec copied to clipboard
convert DMPCollectionConfig and DMPCollectionContext to proper dataclasses
Summary:
The DMPCollectionConfig and DMPCollectionContext classes used field() syntax
at class level but were not decorated with dataclass. This meant:
- The
field()calls were being executed at class definition time but not processed by the dataclass machinery, leaving weirdFieldobjects as default values - The
__post_init__method inDMPCollectionConfigwas never being called, so the validation forShardedModulewas not working - The duplicate
sharding_strategyfield inDMPCollectionContextwithinit=Falsewas overriding the parent's definition incorrectly
Differential Revision: D88991073
@iamzainhuda has exported this pull request. If you are a Meta employee, you can view the originating Diff in D88991073.