pytorch
88ec72e1 - [fbcode][pytorch mobile] Create model reader utilities.

Commit
4 years ago
[fbcode][pytorch mobile] Create model reader utilities. Summary: For some of the end to end flow projects, we will need the capabilities to read module information during model validation or model publishing. Creating this model_reader.py for utilities for model content reading, this diff we included the following functionalities: 1. read the model bytecode version; 2. check if a model is lite PyTorch script module; 3. check if a model is PyTorch script module. This diff is recreated from the reverted diff: D24655999 (https://github.com/pytorch/pytorch/commit/7f056e99dd10cff3dab0a6e1931335a3bb2a1ce4). Test Plan: ``` [xcheng16@devvm1099]/data/users/xcheng16/fbsource/fbcode% buck test //caffe2/torch/fb/mobile/tests:mobile_model_reader_tests Action graph will be rebuilt because files have been added or removed. Parsing buck files: finished in 10.4 sec Creating action graph: finished in 22.2 sec Building: finished in 01:29.1 min (100%) 10619/10619 jobs, 1145 updated Total time: 02:01.8 min More details at https://www.internalfb.com/intern/buck/build/f962dfad-76f9-457a-aca3-768ce20f0c31 Tpx test run coordinator for Facebook. See https://fburl.com/tpx for details. Running with tpx session id: 172633f6-6b5b-49e9-a632-b4efa083a001 Trace available for this run at /tmp/tpx-20201109-165156.109798/trace.log Started reporting to test run: https://our.intern.facebook.com/intern/testinfra/testrun/3940649712677511 ✓ ListingSuccess: caffe2/torch/fb/mobile/tests:mobile_model_reader_tests - main (18.229) ✓ Pass: caffe2/torch/fb/mobile/tests:mobile_model_reader_tests - test_is_pytorch_lite_module (caffe2.torch.fb.mobile.tests.test_model_reader.TestModelLoader) (8.975) ✓ Pass: caffe2/torch/fb/mobile/tests:mobile_model_reader_tests - test_is_pytorch_script_module (caffe2.torch.fb.mobile.tests.test_model_reader.TestModelLoader) (9.136) ✓ Pass: caffe2/torch/fb/mobile/tests:mobile_model_reader_tests - test_read_module_bytecode_version (caffe2.torch.fb.mobile.tests.test_model_reader.TestModelLoader) (9.152) Summary Pass: 3 ListingSuccess: 1 Finished test run: https://our.intern.facebook.com/intern/testinfra/testrun/3940649712677511 ``` Reviewed By: husthyc Differential Revision: D24848563 fbshipit-source-id: ab3371e111206a4bb4d07715c3314596cdc38d2c
Author
Parents
Loading