Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix FeatureProcessor device only to meta when exporting
Summary: D56021085 - This fixed copying FP parameters to meta device when sharding model on meta Weird thing is though that FP parameters are not sparse parameters, they are dense. Therefore, they shouldn’t be moved to meta device as a result of sharding. https://fburl.com/code/xuv9s5k2 - AIMP assumes only sparse params are on meta device. However, the FP parameters should be properly moved when using .to(). That is not the current case, as FeatureProcessorCollections use ParameterDict but also has a mirroring Dict[str, nn.Parameter] for bypassing TorchScript issues with ParameterDict. Therefore, when .to() is used on a model, only the registered ParameterDict will bem oved but not the mirroring Dict. This diff overrides nn.Module _apply to make sure the ParameterDict and Dict are in sync. Differential Revision: D56492970
- Loading branch information