torch.hub: add safe weights_only option to load_state_dict_from_url (#98479)
This adds a `weights_only` option to torch.hub.load_state_dict_from_url which is helpful for loading pretrained models from potentially untrusted sources.
Ex: https://github.com/d4l3k/torchdrive/blob/main/torchdrive/models/simple_bev.py#L618-L621
See https://github.com/pytorch/pytorch/pull/86812 for more info on weights_only
Test plan:
```
pytest test/test_hub.py
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98479
Approved by: https://github.com/NicolasHug