Sanitize module names on legacy import
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27764
Test Plan: Imported from OSS
Differential Revision: D17882924
Pulled By: jamesr66a
fbshipit-source-id: 89809798d29b971ffb7898188a94667c08641801