[package] ensure we don't write files twice to the archive. (#61371)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/61371
The ZIP format allows for writing multiple files with the same name. But
this is handled poorly by most tooling (including our own), so doing so
produces weird behavior depending on the implementation of the ZIP
reader.
Since we have no valid use case for writing multiple files with the same
name to a `torch.package`, just ban it.
Differential Revision:
D29595518
D29595518
Test Plan: Imported from OSS
Reviewed By: Lilyjjo
Pulled By: suo
fbshipit-source-id: b9f5263ab47572abde233745c102af3d6143946e