[torch.Package/TorchScript] refactor ScriptModuleSerializer Exporter (#55958)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55958
This PR refactors the existing ScriptModuleSerializer to be exposed to the public. Most of the code is the same, git just thinks it's different due to it being shifted over a white space. I commented on the actual changes that weren't due to the white space shifting
Test Plan: Imported from OSS
Reviewed By: suo
Differential Revision: D27832546
Pulled By: Lilyjjo
fbshipit-source-id: c73e33211e46fca56053aa45ea2b9a2803eab82c