pytorch
1df4eca6 - [Operator Versioning][Test] Automate model generating process (#70629)

Commit
2 years ago
[Operator Versioning][Test] Automate model generating process (#70629) Summary: This change is to automate the process to generate the old models for testing upgraders. Developer will 1. Add a module in `caffe2/test/jit/fixtures_srcs/fixtures_src.py` 2. Register the module in `caffe2/test/jit/fixtures_srcs/generate_models.py` 3. Run `python test/jit/fixtures_src/generate_models.py` The model will be dumped to `test/jit/fixtures`. This script also ensure: 1. The output model operator version is as expected 2. The output model will include the changed operator Example log: ``` (base) chenlai@chenlai-mp pytorch % python3 /Users/chenlai/pytorch/test/jit/fixtures_src/generate_models.py TestVersionedDivTensorExampleV4() aten::div.Tensor INFO:__main__:Processing TestVersionedDivTensorExampleV4 INFO:__main__:Generating model test_versioned_div_tensor_example_v4 and it's save to /Users/chenlai/pytorch/test/jit/fixtures/test_versioned_div_tensor_example_v4.ptl ``` The second time to run ``` (base) chenlai@chenlai-mp pytorch % python3 /Users/chenlai/pytorch/test/jit/fixtures_src/generate_models.py TestVersionedDivTensorExampleV4() aten::div.Tensor INFO:__main__:Processing TestVersionedDivTensorExampleV4 INFO:__main__:Model test_versioned_div_tensor_example_v4 already exists, skipping ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/70629 ghstack-source-id: 147585826 Test Plan: OSS ``` python3 /Users/chenlai/pytorch/test/jit/fixtures_src/generate_models.py ``` Internal: ``` buck run mode/opt //caffe2/torch/fb/mobile/upgrader_codegen:upgrader_test_models_gen ``` Reviewed By: iseeyuan, tugsbayasgalan Differential Revision: D33410841 fbshipit-source-id: 28e2b851a30f12a74e4ac8a539d76e83bbc4fb3a (cherry picked from commit 6614f1bdf360b69bcf9eb4bca30707e5bd0e8a2b)
Author
Committer
Parents
Loading