Fix collect_env.py with older version of PyTorch (#48076)
Summary:
Inspired by https://github.com/pytorch/pytorch/issues/47993, this fixes the import error in `collect_env.py` with older version of PyTorch when `torch.version` does not have `hip` property.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/48076
Reviewed By: seemethere, xuzhao9
Differential Revision: D25024352
Pulled By: samestep
fbshipit-source-id: 7dff9d2ab80b0bd25f9ca035d8660f38419cdeca