Don't write the ref file unless necessary (#2657)
* Don't write the ref file unless necessary
* Add exception handling when dealing with ref file
* Update src/huggingface_hub/_snapshot_download.py
Co-authored-by: Lucain <lucainp@gmail.com>
* Update src/huggingface_hub/_snapshot_download.py
---------
Co-authored-by: Lucain <lucainp@gmail.com>
Co-authored-by: Lucain <lucain@huggingface.co>