torchrec icon indicating copy to clipboard operation
torchrec copied to clipboard

convert DMPCollectionConfig and DMPCollectionContext to proper dataclasses

Open iamzainhuda opened this issue 1 week ago • 1 comments

Summary: The DMPCollectionConfig and DMPCollectionContext classes used field() syntax at class level but were not decorated with dataclass. This meant:

  1. The field() calls were being executed at class definition time but not processed by the dataclass machinery, leaving weird Field objects as default values
  2. The __post_init__ method in DMPCollectionConfig was never being called, so the validation for ShardedModule was not working
  3. The duplicate sharding_strategy field in DMPCollectionContext with init=False was overriding the parent's definition incorrectly

Differential Revision: D88991073

iamzainhuda avatar Dec 11 '25 22:12 iamzainhuda

@iamzainhuda has exported this pull request. If you are a Meta employee, you can view the originating Diff in D88991073.

meta-codesync[bot] avatar Dec 11 '25 22:12 meta-codesync[bot]