pytorch
2fd14735 - [easy][PyTorchEdge] print error message when failing to load model file (#63404)

Commit
3 years ago
[easy][PyTorchEdge] print error message when failing to load model file (#63404) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/63404 # Context Loading a model file using `fopen` might error out for multiple reasons. Repro'ing the error on devices takes some time and efforts. Logging the error no# will help in debugging and fixing the error quickly. # Mitigation Printout the error message of the `fopen` to help users debug the issue. Test Plan: ``` (base) [pavithran@devvm1803.vll0 /data/users/pavithran/fbsource] buck run xplat/caffe2/fb/lite_predictor:lite_predictor -- --model=/home/pavithran/models/prod/GAaNhAoTIV6cIvgJAHn30m8NR1QgbmQwAAAA.ptl --use_bundled_input=0 Building: finished in 0.5 sec (100%) 354/354 jobs, 0/354 updated Total time: 0.6 sec Run with 24 threads Run with 24 threads Loading model... terminate called after throwing an instance of 'c10::Error' what(): open file failed because of errno 2 on fopen: No such file or directory, file path: /home/pavithran/models/prod/GAaNhAoTIV6cIvgJAHn30m8NR1QgbmQwAAAA.ptl Exception raised from RAIIFile at xplat/caffe2/caffe2/serialize/file_adapter.cc:15 (most recent call first): (no backtrace available) ``` Reviewed By: dhruvbird Differential Revision: D30372308 fbshipit-source-id: 5346e828f53f6bc5d871b403586566a3332a389a
Author
Parents
Loading