mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
[file_utils] do not gobble certain kinds of requests.ConnectionError (#10235)
* do not gobble certain kinds of requests.ConnectionError * Apply review comments Co-authored-by: Lysandre <lysandre.debut@reseau.eseo.fr>
This commit is contained in:
parent
ce9724e1bd
commit
4f3e93cfaf
0
examples/legacy/token-classification/run_tf_ner.py
Normal file → Executable file
0
examples/legacy/token-classification/run_tf_ner.py
Normal file → Executable file
@ -1312,8 +1312,12 @@ def get_from_cache(
|
||||
# between the HEAD and the GET (unlikely, but hey).
|
||||
if 300 <= r.status_code <= 399:
|
||||
url_to_download = r.headers["Location"]
|
||||
except (requests.exceptions.SSLError, requests.exceptions.ProxyError):
|
||||
# Actually raise for those subclasses of ConnectionError
|
||||
raise
|
||||
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout):
|
||||
# etag is already None
|
||||
# Otherwise, our Internet connection is down.
|
||||
# etag is None
|
||||
pass
|
||||
|
||||
filename = url_to_filename(url, etag)
|
||||
|
Loading…
Reference in New Issue
Block a user