Random HF API error
(ReadTimeoutError("HTTPSConnectionPool(host='huggingface.co', port=443): Read timed out. (read timeout=10)"), '(Request ID: 8e09c291-1ee1-4df2-b763-60505b0d4457)')' thrown while requesting HEAD https://huggingface.co/ybelkada/fonts/resolve/main/Arial.TTF
This error is thrown randomly at times when using inference. Why does the model even need to load font files
Complete trace :
Traceback (most recent call last):
File "/home/csgrad/sahmed9/reps/RealCQA/code/chartconv_matcha_eval.py", line 310, in
runeval(ckp_)
File "/home/csgrad/sahmed9/reps/RealCQA/code/chartconv_matcha_eval.py", line 126, in runeval
encoding = processor(images=image, text=question, return_tensors="pt", padding=True, truncation=True, max_length=2048, add_special_tokens=True)
File "/home/csgrad/sahmed9/anaconda3/envs/layoutlmv3/lib/python3.7/site-packages/transformers/models/pix2struct/processing_pix2struct.py", line 113, in call
images, return_tensors=return_tensors, max_patches=max_patches, header_text=text, **kwargs
File "/home/csgrad/sahmed9/anaconda3/envs/layoutlmv3/lib/python3.7/site-packages/transformers/image_processing_utils.py", line 464, in call
return self.preprocess(images, **kwargs)
File "/home/csgrad/sahmed9/anaconda3/envs/layoutlmv3/lib/python3.7/site-packages/transformers/models/pix2struct/image_processing_pix2struct.py", line 399, in preprocess
for i, image in enumerate(images)
File "/home/csgrad/sahmed9/anaconda3/envs/layoutlmv3/lib/python3.7/site-packages/transformers/models/pix2struct/image_processing_pix2struct.py", line 399, in
for i, image in enumerate(images)
File "/home/csgrad/sahmed9/anaconda3/envs/layoutlmv3/lib/python3.7/site-packages/transformers/models/pix2struct/image_processing_pix2struct.py", line 168, in render_header
header_image = render_text(header, **kwargs)
File "/home/csgrad/sahmed9/anaconda3/envs/layoutlmv3/lib/python3.7/site-packages/transformers/models/pix2struct/image_processing_pix2struct.py", line 129, in render_text
font = hf_hub_download(DEFAULT_FONT_PATH, "Arial.TTF")
File "/home/csgrad/sahmed9/anaconda3/envs/layoutlmv3/lib/python3.7/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
File "/home/csgrad/sahmed9/anaconda3/envs/layoutlmv3/lib/python3.7/site-packages/huggingface_hub/file_download.py", line 1199, in hf_hub_download
timeout=etag_timeout,
File "/home/csgrad/sahmed9/anaconda3/envs/layoutlmv3/lib/python3.7/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
File "/home/csgrad/sahmed9/anaconda3/envs/layoutlmv3/lib/python3.7/site-packages/huggingface_hub/file_download.py", line 1541, in get_hf_file_metadata
hf_raise_for_status(r)
File "/home/csgrad/sahmed9/anaconda3/envs/layoutlmv3/lib/python3.7/site-packages/huggingface_hub/utils/_errors.py", line 303, in hf_raise_for_status
raise HfHubHTTPError(str(e), response=response) from e
huggingface_hub.utils._errors.HfHubHTTPError: 500 Server Error: Internal Server Error for url: https://huggingface.co/ybelkada/fonts/resolve/main/Arial.TTF (Request ID: Root=1-65dcbeb5-6620500c340684be592e5278;3c8dad7d-4d07-4f31-9333-ea433dadc625)
aah. is it the question header rendering part of vqa for pix2struct.
Downloaded the font ttf to local and added as a param in image_processing_pix2struct.py", line 129, in render_text
ps. Should really cache local font after first download.
just imagining the number of api calls each time it keeps downloading hurts my head.