Make upgrader test model generation more robust (#72030)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/72030
Test Plan: Imported from OSS
Reviewed By: mrshenli
Differential Revision: D33863263
Pulled By: tugsbayasgalan
fbshipit-source-id: 931578848ba530583008be6540003b2dcf4d55ce
(cherry picked from commit 67cd085104631264eb12c2c808eb4ed7b973a652)