hf-hub
hf-hub copied to clipboard
fix(metadata): check content size by linked size and head content-length as fallback
This is pr is intented to keep the same behavior with https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/file_download.py#L1408
Background
In China mainland, we mostly use hf-mirror.com as mirror endpoint, which serves range stream without Content-Range header causing hf-hub Missing Header Error
Furthermore
Might we consider RANGE GET request failed and Content-Range is not available, and fallback to HEAD request?