Properly catch warning in torchhub tests (#74430)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/74430
Test Plan: Imported from OSS
Reviewed By: anjali411
Differential Revision: D35011900
Pulled By: NicolasHug
fbshipit-source-id: 36753167d6ee737ee437d1cd7303e5cc8b5c286c
(cherry picked from commit d0fdf4af795bdf74c145260c82f976a53f1aaff5)