Only look for Caffe2 package when shared (#18421)
Summary:
Previously it would look for the Config even if it was not written.
Fixed #18419
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18421
Differential Revision: D14597139
Pulled By: ezyang
fbshipit-source-id: c212cbf5dc91564c12d9d07e507c8285e11c6bdf